]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix evals maths
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Oct 2018 17:52:53 +0000 (18:52 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Oct 2018 17:52:53 +0000 (18:52 +0100)
src/libutil/expression.c

index 2469d04151dc4cac0320406722064432b40615ee..65465ceb6c3bd4b77446c39ebb7ca548a71f2ac2 100644 (file)
@@ -1098,16 +1098,15 @@ rspamd_process_expression_track (struct rspamd_expression *expr, struct rspamd_e
        /* Ensure that stack is empty at this point */
        g_assert (expr->expression_stack->len == 0);
 
+       expr->evals ++;
        ret = rspamd_ast_process_node (expr, expr->ast, process_data);
 
        /* Cleanup */
        g_node_traverse (expr->ast, G_IN_ORDER, G_TRAVERSE_ALL, -1,
                        rspamd_ast_cleanup_traverse, NULL);
 
-       expr->evals ++;
-
        /* Check if we need to resort */
-       if (expr->evals == expr->next_resort) {
+       if (expr->evals % expr->next_resort == 0) {
                expr->next_resort = ottery_rand_range (MAX_RESORT_EVALS) +
                                MIN_RESORT_EVALS;
                /* Set priorities for branches */