Skip to content

Commit

Permalink
lib: monkey: sync capacity improvement
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich committed Feb 21, 2022
1 parent 4a84454 commit 9a28cba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/monkey/mk_server/mk_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ static inline int _next_target(struct mk_server *server)
* If sched_ctx->workers[target] worker is full then the whole server too,
* because it has the lowest load.
*/
if (mk_unlikely(cur >= server->server_capacity)) {
if (mk_unlikely(server->server_capacity > 0 &&
server->server_capacity <= cur)) {
MK_TRACE("Too many clients: %i", server->server_capacity);

/* Instruct to close the connection anyways, we lie, it will die */
Expand Down

0 comments on commit 9a28cba

Please sign in to comment.