X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/0a546fc01758f9a9f8b2113764c2cf963df6ef20..697af434fbeb2e3ba2ba9687cd283ed1a2734fa5:/src/aof.c?ds=inline diff --git a/src/aof.c b/src/aof.c index 2396ba2c..959a5f52 100644 --- a/src/aof.c +++ b/src/aof.c @@ -218,6 +218,7 @@ int loadAppendOnlyFile(char *filename) { FILE *fp = fopen(filename,"r"); struct redis_stat sb; int appendonly = server.appendonly; + long loops = 0; if (redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) return REDIS_ERR; @@ -232,6 +233,8 @@ int loadAppendOnlyFile(char *filename) { server.appendonly = 0; fakeClient = createFakeClient(); + startLoading(fp); + while(1) { int argc, j; unsigned long len; @@ -241,6 +244,12 @@ int loadAppendOnlyFile(char *filename) { struct redisCommand *cmd; int force_swapout; + /* Serve the clients from time to time */ + if (!(loops++ % 1000)) { + loadingProgress(ftello(fp)); + aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT); + } + if (fgets(buf,sizeof(buf),fp) == NULL) { if (feof(fp)) break; @@ -297,6 +306,7 @@ int loadAppendOnlyFile(char *filename) { fclose(fp); freeFakeClient(fakeClient); server.appendonly = appendonly; + stopLoading(); return REDIS_OK; readerr: