]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Tweaks for sessions cache
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 4 Jul 2017 07:49:57 +0000 (08:49 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 4 Jul 2017 07:49:57 +0000 (08:49 +0100)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c
src/libserver/worker_util.c

index 8c7b392621729c171c357b47edee5750241dded5..2932bdd894991eb8b08135c8c806b06b46671d46 100644 (file)
@@ -412,7 +412,7 @@ struct rspamd_config {
        guint max_word_len;                                                             /**< maximum length of the word to be considered                */
        guint words_decay;                                                              /**< limit for words for starting adaptive ignoring             */
        guint history_rows;                                                             /**< number of history rows stored                                              */
-       guint max_session_cache;                        /**< maximum number of sessions cache elts                              */
+       guint max_sessions_cache;                        /**< maximum number of sessions cache elts                             */
 
        GList *classify_headers;                                                /**< list of headers using for statistics                               */
        struct module_s **compiled_modules;                             /**< list of compiled C modules                                                 */
index f4ca6ded7e3d742dda8424c287dad694eeabe16a..ddc9ca06647e8a0a465522d13f9d5f6c9c4785d7 100644 (file)
@@ -2206,9 +2206,9 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
                        0,
                        "Enable sessions cache to debug dangling sessions");
        rspamd_rcl_add_default_handler (sub,
-                       "max_session_cache",
+                       "max_sessions_cache",
                        rspamd_rcl_parse_struct_integer,
-                       G_STRUCT_OFFSET (struct rspamd_config, max_session_cache),
+                       G_STRUCT_OFFSET (struct rspamd_config, max_sessions_cache),
                        0,
                        "Maximum number of sessions in cache before warning (default: 100)");
 
index abc647dcba1bdae9dda1bedb50039f09772f00d7..dce0e0bac631fee08961d7b8ab4d0d113e740ca2 100644 (file)
@@ -182,7 +182,7 @@ rspamd_config_new (void)
        cfg->redis_pool = rspamd_redis_pool_init ();
 #endif
        cfg->default_max_shots = DEFAULT_MAX_SHOTS;
-       cfg->max_session_cache = DEFAULT_MAX_SESSIONS;
+       cfg->max_sessions_cache = DEFAULT_MAX_SESSIONS;
 
        REF_INIT_RETAIN (cfg, rspamd_config_free);
 
index bb6f9221d54ecf4ab2000bc2f0dc2942764f4614..fcd9a8be9becb57ed56aeb181119d63b712e41b9 100644 (file)
@@ -717,7 +717,7 @@ rspamd_session_cache_sort_cmp (gconstpointer pa, gconstpointer pb)
                        *e1 = *(const struct rspamd_worker_session_elt **)pa,
                        *e2 = *(const struct rspamd_worker_session_elt **)pb;
 
-       return e1->when < e2->when;
+       return e2->when < e1->when;
 }
 
 static void
@@ -732,7 +732,7 @@ rspamd_sessions_cache_periodic (gint fd, short what, gpointer p)
        GPtrArray *res;
        guint i;
 
-       if (g_hash_table_size (c->cache) > c->cfg->max_session_cache) {
+       if (g_hash_table_size (c->cache) > c->cfg->max_sessions_cache) {
                res = g_ptr_array_sized_new (g_hash_table_size (c->cache));
                g_hash_table_iter_init (&it, c->cache);
 
@@ -741,7 +741,7 @@ rspamd_sessions_cache_periodic (gint fd, short what, gpointer p)
                }
 
                msg_err ("sessions cache is overflowed %d elements where %d is limit",
-                               (gint)res->len, (gint)c->cfg->max_session_cache);
+                               (gint)res->len, (gint)c->cfg->max_sessions_cache);
                g_ptr_array_sort (res, rspamd_session_cache_sort_cmp);
 
                PTR_ARRAY_FOREACH (res, i, elt) {