diff --git a/src/server.c b/src/server.c index 61291fde..c9972115 100644 --- a/src/server.c +++ b/src/server.c @@ -908,12 +908,15 @@ void databasesCron(void) { /* Rehash */ if (server.activerehashing) { for (j = 0; j < dbs_per_call; j++) { - int work_done = incrementallyRehash(rehash_db % server.dbnum); - rehash_db++; + int work_done = incrementallyRehash(rehash_db); if (work_done) { /* If the function did some work, stop here, we'll do * more at the next cron loop. */ break; + } else { + /* If this db didn't need rehash, we'll try the next one. */ + rehash_db++; + rehash_db %= server.dbnum; } } }