diff --git a/src/stratifier.c b/src/stratifier.c index cabc654c..37a0cda7 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -908,10 +908,10 @@ static void broadcast_ping(sdata_t *sdata); static void *do_update(void *arg) { struct update_req *ur = (struct update_req *)arg; + int prio = ur->prio, retries = 0; ckpool_t *ckp = ur->ckp; sdata_t *sdata = ckp->data; bool new_block = false; - int prio = ur->prio; bool ret = false; workbase_t *wb; time_t now_t; @@ -921,15 +921,20 @@ static void *do_update(void *arg) pthread_detach(pthread_self()); rename_proc("updater"); +retry: buf = send_recv_generator(ckp, "getbase", prio); if (unlikely(!buf)) { LOGNOTICE("Get base in update_base delayed due to higher priority request"); goto out; } if (unlikely(cmdmatch(buf, "failed"))) { - LOGWARNING("Generator returned failure in update_base"); - goto out; + if (retries++ < 5 || prio == GEN_PRIORITY) { + LOGWARNING("Generator returned failure in update_base, retry #%d", retries); + goto retry; + } } + if (unlikely(retries)) + LOGWARNING("Generator succeeded in update_base after retrying"); wb = ckzalloc(sizeof(workbase_t)); wb->ckp = ckp;