MCPcopy Create free account
hub / github.com/F-Stack/f-stack / processEventsWhileBlocked

Function processEventsWhileBlocked

app/redis-6.2.6/src/networking.c:3406–3433  ·  view source on GitHub ↗

This function is called by Redis in order to process a few events from * time to time while blocked into some not interruptible operation. * This allows to reply to clients with the -LOADING error while loading the * data set at startup or after a full resynchronization with the master * and so forth. * * It calls the event loop in order to process a few events. Specifically we * try to cal

Source from the content-addressed store, hash-verified

3404 *
3405 * The function returns the total number of events processed. */
3406void processEventsWhileBlocked(void) {
3407 int iterations = 4; /* See the function top-comment. */
3408
3409 /* Update our cached time since it is used to create and update the last
3410 * interaction time with clients and for other important things. */
3411 updateCachedTime(0);
3412
3413 /* Note: when we are processing events while blocked (for instance during
3414 * busy Lua scripts), we set a global flag. When such flag is set, we
3415 * avoid handling the read part of clients using threaded I/O.
3416 * See https://github.com/redis/redis/issues/6988 for more info. */
3417 ProcessingEventsWhileBlocked = 1;
3418 while (iterations--) {
3419 long long startval = server.events_processed_while_blocked;
3420 long long ae_events = aeProcessEvents(server.el,
3421 AE_FILE_EVENTS|AE_DONT_WAIT|
3422 AE_CALL_BEFORE_SLEEP|AE_CALL_AFTER_SLEEP);
3423 /* Note that server.events_processed_while_blocked will also get
3424 * incremeted by callbacks called by the event loop handlers. */
3425 server.events_processed_while_blocked += ae_events;
3426 long long events = server.events_processed_while_blocked - startval;
3427 if (!events) break;
3428 }
3429
3430 whileBlockedCron();
3431
3432 ProcessingEventsWhileBlocked = 0;
3433}
3434
3435/* ==========================================================================
3436 * Threaded I/O

Callers 3

luaMaskCountHookFunction · 0.85
rdbLoadProgressCallbackFunction · 0.85
loadAppendOnlyFileFunction · 0.85

Calls 3

updateCachedTimeFunction · 0.85
aeProcessEventsFunction · 0.85
whileBlockedCronFunction · 0.85

Tested by

no test coverage detected