Skip to content

Commit

Permalink
CP-51692: Do not enable Event.next ratelimiting if Event.next is stil…
Browse files Browse the repository at this point in the history
…l used internally

By default Event.next is still used internally, so although this API is deprecated do not yet enable the throttling by default.
Fixes: 3e1d8a2 ("CP-51692: Event.next: use same batching as Event.from")
Fixes: 2b4e0db ("CP-49158: [prep] Event.{from,next}: make delays configurable and prepare for task specific delays")

It slows down all synchronous API calls that create tasks, like VM.start.

Only enable the throttling when Event.next is not used internally (`use-event-next = false` in xapi.conf),
which will eventually become the default.

The code prior to the above changes used 0 delay between checking for events, so do the same here (although this lead to a lot of inefficient wakeups of all active tasks in XAPI, whenever anything changes, it matches previous behaviour)

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Jan 13, 2025
1 parent 9c5c8dd commit 77147a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ocaml/xapi/xapi_event.ml
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,13 @@ let unregister ~__context ~classes =

(** Blocking call which returns the next set of events relevant to this session. *)
let rec next ~__context =
let batching = !Xapi_globs.event_next_delay in
let batching =
if !Constants.use_event_next then
Throttle.Batching.make ~delay_before:Mtime.Span.zero
~delay_between:Mtime.Span.zero
else
!Xapi_globs.event_next_delay
in
let session = Context.get_session_id __context in
let open Next in
assert_subscribed session ;
Expand Down

0 comments on commit 77147a3

Please sign in to comment.