]> source.dussan.org Git - rspamd.git/commitdiff
Assign parent weight and avg_time on load.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 28 May 2015 08:15:52 +0000 (09:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 28 May 2015 08:15:52 +0000 (09:15 +0100)
src/libserver/symbols_cache.c

index bde412461b4946e865c8126b10bc2339ff537423..2c62cd6be900caa7671ea9ef6b7dba5edb407f0c 100644 (file)
@@ -243,6 +243,21 @@ rspamd_symbols_cache_load_items (struct symbols_cache *cache, const gchar *name)
                }
        }
 
+       if (item->type == SYMBOL_TYPE_VIRTUAL && item->parent != -1) {
+               g_assert (item->parent < cache->items_by_order->len);
+               parent = g_ptr_array_index (cache->items_by_order, item->parent);
+
+               if (parent->weight < item->weight) {
+                       parent->weight = item->weight;
+               }
+
+               /*
+                * We maintain avg_time for virtual symbols equal to the
+                * parent item avg_time
+                */
+               parent->avg_time = item->avg_time;
+       }
+
        ucl_object_iterate_free (it);
        ucl_object_unref (top);