Yield if the backlog is long.
This commit is contained in:
parent
536f1a03d2
commit
de9104cdb5
|
@ -61,6 +61,11 @@ let shoveller info =
|
|||
let queue_handler info n sexp =
|
||||
match Message.message_of_sexp sexp with
|
||||
| Message.Post (name, body, token) ->
|
||||
lwt () =
|
||||
if info.backlog > 1000 && info.waiters > 0
|
||||
then Lwt_unix.yield ()
|
||||
else return ()
|
||||
in
|
||||
info.backlog <- info.backlog + 1;
|
||||
info.backlog_out (Some body);
|
||||
return ()
|
||||
|
|
Loading…
Reference in New Issue