rspamd_controller_load_saved_stats (ctx);
/* RRD collector */
- if (ctx->cfg->rrd_file) {
+ if (ctx->cfg->rrd_file && worker->index == 0) {
ctx->rrd = rspamd_rrd_file_default (ctx->cfg->rrd_file, NULL);
if (ctx->rrd) {
event_add (ctx->rrd_event, &rrd_update_time);
}
}
+ else {
+ ctx->rrd = NULL;
+ }
rspamd_controller_password_sane (ctx, ctx->password, "normal password");
rspamd_controller_password_sane (ctx, ctx->enable_password, "enable "
#define HARD_TERMINATION_TIME 10
static struct rspamd_worker * fork_worker (struct rspamd_main *,
- struct rspamd_worker_conf *);
+ struct rspamd_worker_conf *, guint);
static gboolean load_rspamd_config (struct rspamd_config *cfg,
gboolean init_modules);
}
static struct rspamd_worker *
-fork_worker (struct rspamd_main *rspamd, struct rspamd_worker_conf *cf)
+fork_worker (struct rspamd_main *rspamd, struct rspamd_worker_conf *cf,
+ guint index)
{
struct rspamd_worker *cur;
/* Starting worker process */
cur->pid = fork ();
cur->cf = g_malloc (sizeof (struct rspamd_worker_conf));
memcpy (cur->cf, cf, sizeof (struct rspamd_worker_conf));
- cur->pending = FALSE;
+ cur->index = index;
cur->ctx = cf->ctx;
switch (cur->pid) {
case 0:
cf = cur->data;
workers_pending = g_list_remove_link (workers_pending, cur);
- fork_worker (rspamd, cf);
+ fork_worker (rspamd, cf, cf->count);
g_list_free_1 (cur);
}
}
msg_warn_main ("cannot spawn more than 1 %s worker, so spawn one",
cf->worker->name);
}
- fork_worker (rspamd, cf);
+ fork_worker (rspamd, cf, 0);
}
else if (cf->worker->threaded) {
- fork_worker (rspamd, cf);
+ fork_worker (rspamd, cf, 0);
}
else {
for (i = 0; i < cf->count; i++) {
- fork_worker (rspamd, cf);
+ fork_worker (rspamd, cf, i);
}
}
}
*/
struct rspamd_worker {
pid_t pid; /**< pid of worker */
- gboolean is_initialized; /**< is initialized */
- gboolean is_dying; /**< if worker is going to shutdown */
- gboolean pending; /**< if worker is pending to run */
+ guint index; /**< index number */
struct rspamd_main *srv; /**< pointer to server structure */
GQuark type; /**< process type */
GHashTable *signal_events; /**< signal events */