X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/80e87a461a7d2ee54430127bdb6ac014778c54c5..d47ded66ce3c36eb41f38a20ebb5633dfa2e77b0:/src/redis.c diff --git a/src/redis.c b/src/redis.c index 0bedc25b..3289ec1e 100644 --- a/src/redis.c +++ b/src/redis.c @@ -29,6 +29,7 @@ #include "redis.h" #include "slowlog.h" +#include "bio.h" #ifdef HAVE_BACKTRACE #include @@ -575,6 +576,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { * in objects at every object access, and accuracy is not needed. * To access a global var is faster than calling time(NULL) */ server.unixtime = time(NULL); + /* We have just 22 bits per object for LRU information. * So we use an (eventually wrapping) LRU clock with 10 seconds resolution. * 2^22 bits with 10 seconds resoluton is more or less 1.5 years. @@ -685,7 +687,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { server.auto_aofrewrite_perc && server.appendonly_current_size > server.auto_aofrewrite_min_size) { - int base = server.auto_aofrewrite_base_size ? + long long base = server.auto_aofrewrite_base_size ? server.auto_aofrewrite_base_size : 1; long long growth = (server.appendonly_current_size*100/base) - 100; if (growth >= server.auto_aofrewrite_perc) { @@ -707,6 +709,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { /* Run other sub-systems specific cron jobs */ if (server.cluster_enabled && !(loops % 10)) clusterCron(); +if (!(loops % 10)) bioCreateBackgroundJob(REDIS_BIO_CLOSE_FILE,(void*)1000); server.cronloops++; return 100; } @@ -965,6 +968,7 @@ void initServer() { if (server.cluster_enabled) clusterInit(); scriptingInit(); slowlogInit(); + bioInit(); srand(time(NULL)^getpid()); }