struct istream *input;
bool explicit_socket_path;
bool hash_map, user_map, force_flush;
+ int64_t max_parallel;
};
struct user_list {
ctx->vhost_count = NULL;
if (!doveadm_cmd_param_str(cctx, "passdb-field", &(ctx->passdb_field)))
ctx->passdb_field = NULL;
+ if (!doveadm_cmd_param_int64(cctx, "max-parallel", &(ctx->max_parallel)))
+ ctx->max_parallel = 0;
if (!ctx->user_map)
director_connect(ctx);
return ctx;
{
const char *line;
- director_send(ctx, ctx->force_flush ?
- "HOST-FLUSH\n" : "HOST-RESET-USERS\n");
+ if (ctx->force_flush)
+ line = "HOST-FLUSH\n";
+ else if (ctx->max_parallel > 0) {
+ line = t_strdup_printf("HOST-RESET-USERS\t\t%lld\n",
+ (long long)ctx->max_parallel);
+ } else {
+ line = "HOST-RESET-USERS\n";
+ }
+ director_send(ctx, line);
line = i_stream_read_next_line(ctx->input);
if (line == NULL) {
unsigned int i, ips_count;
struct ip_addr ip;
const char *line;
+ string_t *cmd;
ctx = cmd_director_init(cctx);
if (ctx->host == NULL) {
if (director_get_host(ctx->host, &ips, &ips_count) != 0) return;
}
+ cmd = t_str_new(64);
for (i = 0; i < ips_count; i++) {
- director_send(ctx, t_strdup_printf("%s\t%s\n",
- ctx->force_flush ? "HOST-FLUSH" : "HOST-RESET-USERS",
- net_ip2addr(&ip)));
+ str_truncate(cmd, 0);
+ if (ctx->force_flush)
+ str_printfa(cmd, "HOST-FLUSH\t%s\n", net_ip2addr(&ip));
+ else {
+ str_printfa(cmd, "HOST-RESET-USERS\t%s", net_ip2addr(&ip));
+ if (ctx->max_parallel > 0) {
+ str_printfa(cmd, "\t%lld",
+ (long long)ctx->max_parallel);
+ }
+ str_append_c(cmd, '\n');
+ }
+ director_send(ctx, str_c(cmd));
}
for (i = 0; i < ips_count; i++) {
line = i_stream_read_next_line(ctx->input);
{
.name = "director flush",
.cmd = cmd_director_flush,
- .usage = "[-a <director socket path>] [-F] <host>|all",
+ .usage = "[-a <director socket path>] [-F] [--max-parallel <n>] <host>|all",
DOVEADM_CMD_PARAMS_START
DOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
DOVEADM_CMD_PARAM('F', "force-flush", CMD_PARAM_BOOL, 0)
+DOVEADM_CMD_PARAM('\0', "max-parallel", CMD_PARAM_INT64, 0)
DOVEADM_CMD_PARAM('\0', "host", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
DOVEADM_CMD_PARAMS_END
},