Parcourir la source

[Fix] Allow to set 0 as number of rows to disable roll history

Issue: #4947
Closes: #4947
pull/4953/head
Vsevolod Stakhov il y a 1 mois
Parent
révision
12f965bf98
Aucun compte lié à l'adresse e-mail de l'auteur
3 fichiers modifiés avec 9 ajouts et 6 suppressions
  1. 2
    2
      src/controller.c
  2. 3
    1
      src/libserver/protocol.c
  3. 4
    3
      src/rspamd.c

+ 2
- 2
src/controller.c Voir le fichier



L = ctx->cfg->lua_state; L = ctx->cfg->lua_state;


if (!ctx->srv->history->disabled) {
if (ctx->srv->history && !ctx->srv->history->disabled) {
rspamd_controller_handle_legacy_history(session, ctx, conn_ent, msg); rspamd_controller_handle_legacy_history(session, ctx, conn_ent, msg);
} }
else { else {
return 0; return 0;
} }


if (!ctx->srv->history->disabled) {
if (ctx->srv->history && !ctx->srv->history->disabled) {
/* Clean from start to the current row */ /* Clean from start to the current row */
completed_rows = g_atomic_int_get(&ctx->srv->history->cur_row); completed_rows = g_atomic_int_get(&ctx->srv->history->cur_row);



+ 3
- 1
src/libserver/protocol.c Voir le fichier

} }


if (!(task->flags & RSPAMD_TASK_FLAG_NO_LOG)) { if (!(task->flags & RSPAMD_TASK_FLAG_NO_LOG)) {
rspamd_roll_history_update(task->worker->srv->history, task);
if (task->worker->srv->history) {
rspamd_roll_history_update(task->worker->srv->history, task);
}
} }
else { else {
msg_debug_protocol("skip history update due to no log flag"); msg_debug_protocol("skip history update due to no log flag");

+ 4
- 3
src/rspamd.c Voir le fichier



/* Create rolling history */ /* Create rolling history */
rspamd_main->history = rspamd_roll_history_new(rspamd_main->server_pool, rspamd_main->history = rspamd_roll_history_new(rspamd_main->server_pool,
rspamd_main->cfg->history_rows, rspamd_main->cfg);
rspamd_main->cfg->history_rows,
rspamd_main->cfg);


msg_info_main("rspamd " RVERSION msg_info_main("rspamd " RVERSION
" is starting, build id: " RID); " is starting, build id: " RID);
} }


/* Maybe read roll history */ /* Maybe read roll history */
if (rspamd_main->cfg->history_file) {
if (rspamd_main->history && rspamd_main->cfg->history_file) {
rspamd_roll_history_load(rspamd_main->history, rspamd_roll_history_load(rspamd_main->history,
rspamd_main->cfg->history_file); rspamd_main->cfg->history_file);
} }
ev_loop(event_loop, 0); ev_loop(event_loop, 0);


/* Maybe save roll history */ /* Maybe save roll history */
if (rspamd_main->cfg->history_file) {
if (rspamd_main->history && rspamd_main->cfg->history_file) {
rspamd_roll_history_save(rspamd_main->history, rspamd_roll_history_save(rspamd_main->history,
rspamd_main->cfg->history_file); rspamd_main->cfg->history_file);
} }

Chargement…
Annuler
Enregistrer