Skip to content

Commit

Permalink
Update src/server.c
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Brunner <[email protected]>
  • Loading branch information
JimB123 authored Dec 5, 2024
1 parent cb816fb commit ea6499b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ long long clientsTimerProc(struct aeEventLoop *eventLoop, long long id, void *cl

int numclients = listLength(server.clients);
int clients_this_cycle = numclients / server.hz; /* Initial computation based on standard hz */
int delayMs;
int delay_ms;

if (clients_this_cycle < CLIENTS_CRON_MIN_ITERATIONS) {
clients_this_cycle = min(numclients, CLIENTS_CRON_MIN_ITERATIONS);
Expand All @@ -1134,14 +1134,14 @@ long long clientsTimerProc(struct aeEventLoop *eventLoop, long long id, void *cl
if (clients_this_cycle > MAX_CLIENTS_PER_CLOCK_TICK) {
clients_this_cycle = MAX_CLIENTS_PER_CLOCK_TICK;
float required_hz = (float)numclients / MAX_CLIENTS_PER_CLOCK_TICK;
delayMs = 1000.0 / required_hz;
delay_ms = 1000.0 / required_hz;
} else {
delayMs = 1000 / server.hz;
delay_ms= 1000 / server.hz;
}

clientsCron(clients_this_cycle);

return delayMs;
return delay_ms;
}

/* This function handles 'background' operations we are required to do
Expand Down

0 comments on commit ea6499b

Please sign in to comment.