]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Table: pruning is deferred by task time, not by item count
authorMaria Matejka <mq@ucw.cz>
Mon, 10 Jun 2024 09:35:07 +0000 (11:35 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 12 Jun 2024 12:48:33 +0000 (14:48 +0200)
nest/rt-table.c

index a72964a3b59ca90eb1b034b5dacde4737920c49d..7fb6663c8f682744f27d2e24de13d4516a6100a8 100644 (file)
@@ -3312,7 +3312,6 @@ rt_prune_table(void *_tab)
 {
   RT_LOCK((rtable *) _tab, tab);
 
-  int limit = 2000;
   struct rt_import_hook *ih;
   node *n, *x;
 
@@ -3352,21 +3351,15 @@ rt_prune_table(void *_tab)
   for (; tab->prune_index < bs; tab->prune_index++)
     {
       net *n = &routes[tab->prune_index];
-      while ((limit > 0) && rt_prune_net(tab, n))
-       limit--;
-
-      if (limit <= 0)
-      {
-       ev_send_loop(tab->loop, tab->prune_event);
-       return;
-      }
+      while (rt_prune_net(tab, n))
+       MAYBE_DEFER_TASK(birdloop_event_list(tab->loop), tab->prune_event,
+           "%s pruning", tab->name);
 
       struct rte_storage *e = NET_BEST_ROUTE(tab, n);
       if (tab->trie_new && e)
       {
        const net_addr *a = e->rte.net;
        trie_add_prefix(tab->trie_new, a, a->pxlen, a->pxlen);
-       limit--;
       }
     }