Skip to content

Commit

Permalink
CA-91930: Remove union of subscriptions between event.from invocations.
Browse files Browse the repository at this point in the history
This fixes an issue whereby when parallel event.from calls were being
processed, each call would get the union of events meant for each. This
causes particular problems when XenCenter is connected as it registers
for _all_ events. Therefore any other calls made to event.from will
receive _all_ events whenever the GUI is connected. Additionally, as
there is no way to generate a token for 'now', this means that the
initial call to event.from will dump the _entire_ database, including
all the messages, requiring reading these from the disk.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
  • Loading branch information
Jon Ludlam committed Oct 9, 2012
1 parent e6de369 commit 2066206
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ocaml/xapi/xapi_event.ml
Expand Up @@ -324,15 +324,14 @@ let from ~__context ~classes ~token ~timeout =
objs
in

let all_subs = Mutex.execute sub.m (fun () -> Hashtbl.fold (fun _ s acc -> s.subs @ acc) subscriptions []) in
let tables = List.filter (fun table -> table_matches all_subs table) all_event_tables in
let tables = List.filter (fun table -> table_matches sub.subs table) all_event_tables in

let events_lost = ref [] in

let grab_range t =
let tableset = Db_cache_types.Database.tableset (Db_ref.get_database t) in
let (msg_gen,messages) =
if table_matches all_subs "message" then (!message_get_since_for_events) ~__context sub.last_msg_gen else (0L, []) in
if table_matches sub.subs "message" then (!message_get_since_for_events) ~__context sub.last_msg_gen else (0L, []) in
(msg_gen, messages, tableset, List.fold_left
(fun acc table ->
Db_cache_types.Table.fold_over_recent sub.last_generation
Expand Down

0 comments on commit 2066206

Please sign in to comment.