Permalink
Browse files

CA-91930: Remove union of subscriptions between event.from invocations.

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...
1 parent e1b296a commit 87648c83e494b0c31aff41181e20a45d46f677b3 @jonludlam jonludlam committed Oct 8, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 ocaml/xapi/xapi_event.ml
View
5 ocaml/xapi/xapi_event.ml
@@ -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

0 comments on commit 87648c8

Please sign in to comment.