0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Table: pruning is deferred by task time, not by item count

This commit is contained in:
Maria Matejka 2024-06-10 11:35:07 +02:00
parent 464d483af4
commit 0827797e6e

View File

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