diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-27 11:56:28 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-27 11:56:28 +0000 |
commit | d8c8fd5641a138cdf6e7dd6ee8dae39c4815cbae (patch) | |
tree | 4197ccecb08fe05bac0fac49b08a81506c9af641 /src | |
parent | ff2894404eadc85f19cdff4e71ac6d96eddb839b (diff) | |
download | rspamd-d8c8fd5641a138cdf6e7dd6ee8dae39c4815cbae.tar.gz rspamd-d8c8fd5641a138cdf6e7dd6ee8dae39c4815cbae.zip |
[Fix] Treat learning errors as non-fatal
Issue: #2637
Diffstat (limited to 'src')
-rw-r--r-- | src/client/rspamdclient.c | 2 | ||||
-rw-r--r-- | src/libstat/stat_process.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c index 490e5c369..a4a1fb95e 100644 --- a/src/client/rspamdclient.c +++ b/src/client/rspamdclient.c @@ -124,7 +124,7 @@ rspamd_client_finish_handler (struct rspamd_http_connection *conn, return 0; } else { - if (rspamd_http_message_get_body (msg, NULL) == NULL || msg->code != 200) { + if (rspamd_http_message_get_body (msg, NULL) == NULL || msg->code / 100 != 2) { err = g_error_new (RCLIENT_ERROR, msg->code, "HTTP error: %d, %.*s", msg->code, (gint)msg->status->len, msg->status->str); diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index d601dbee9..d097e12e0 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -526,7 +526,7 @@ rspamd_stat_classifiers_learn (struct rspamd_stat_ctx *st_ctx, if ((task->flags & RSPAMD_TASK_FLAG_ALREADY_LEARNED) && err != NULL && *err == NULL) { /* Do not learn twice */ - g_set_error (err, rspamd_stat_quark (), 404, "<%s> has been already " + g_set_error (err, rspamd_stat_quark (), 208, "<%s> has been already " "learned as %s, ignore it", task->message_id, spam ? "spam" : "ham"); @@ -635,7 +635,7 @@ rspamd_stat_classifiers_learn (struct rspamd_stat_ctx *st_ctx, if (!learned && err && *err == NULL) { if (too_large) { - g_set_error (err, rspamd_stat_quark (), 400, + g_set_error (err, rspamd_stat_quark (), 204, "<%s> contains more tokens than allowed for %s classifier: " "%d > %d", task->message_id, @@ -644,7 +644,7 @@ rspamd_stat_classifiers_learn (struct rspamd_stat_ctx *st_ctx, cl->cfg->max_tokens); } else if (too_small) { - g_set_error (err, rspamd_stat_quark (), 400, + g_set_error (err, rspamd_stat_quark (), 204, "<%s> contains less tokens than required for %s classifier: " "%d < %d", task->message_id, @@ -653,7 +653,7 @@ rspamd_stat_classifiers_learn (struct rspamd_stat_ctx *st_ctx, cl->cfg->min_tokens); } else if (conditionally_skipped) { - g_set_error (err, rspamd_stat_quark (), 410, + g_set_error (err, rspamd_stat_quark (), 204, "<%s> is skipped for %s classifier: " "%s", task->message_id, |