From 67d6a5ee6d0ba1f43dfeb3b2351273222d921c37 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 5 Feb 2016 09:07:27 +1100 Subject: [PATCH] Don't stack low priority updates --- src/stratifier.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stratifier.c b/src/stratifier.c index 5a7431c8..4fde094b 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1317,7 +1317,15 @@ static void *do_update(void *arg) rename_proc("updater"); /* Serialise access to getbase to avoid out of order new block notifies */ - cksem_wait(&sdata->update_sem); + if (prio < GEN_PRIORITY) { + /* Don't queue another routine update if one is already in + * progress. */ + if (cksem_trywait(&sdata->update_sem)) { + LOGINFO("Skipped lowprio update base"); + goto out_free; + } + } else + cksem_wait(&sdata->update_sem); retry: buf = send_recv_generator(ckp, "getbase", prio); if (unlikely(!buf)) { @@ -1379,6 +1387,7 @@ out: broadcast_ping(sdata); } dealloc(buf); +out_free: free(ur->pth); free(ur); return NULL;