Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-binbin committed Feb 26, 2024
1 parent 7fbf162 commit 8268233
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ae.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ aeEventLoop *aeCreateEventLoop(int setsize) {
eventLoop->beforesleep = NULL;
eventLoop->aftersleep = NULL;
eventLoop->flags = 0;
eventLoop->numevents = 0;
if (aeApiCreate(eventLoop) == -1) goto err;
/* Events with mask == AE_NONE are not set. So let's initialize the
* vector with it. */
Expand Down Expand Up @@ -403,6 +404,9 @@ int aeProcessEvents(aeEventLoop *eventLoop, int flags)
numevents = 0;
}

/* Cache the returned numevents. */
eventLoop.numevents = numevents;

/* After sleep callback. */
if (eventLoop->aftersleep != NULL && flags & AE_CALL_AFTER_SLEEP)
eventLoop->aftersleep(eventLoop);
Expand Down
1 change: 1 addition & 0 deletions src/ae.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ typedef struct aeEventLoop {
aeBeforeSleepProc *beforesleep;
aeBeforeSleepProc *aftersleep;
int flags;
int numevents; /* The return value of poll in aeProcessEvents. */
} aeEventLoop;

/* Prototypes */
Expand Down
2 changes: 2 additions & 0 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,8 @@ void clientsCron(void) {
* incrementally in Redis databases, such as active key expiring, resizing,
* rehashing. */
void databasesCron(void) {
serverLog(LL_WARNING, "server event numevents: %d", server.el->numevents);

/* Expire keys by random sampling. Not required for slaves
* as master will synthesize DELs for us. */
if (server.active_expire_enabled) {
Expand Down

0 comments on commit 8268233

Please sign in to comment.