X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c088fcf0b5aaf31195ec1b94873e93f1fd3ee8ed..1f7dbdb87eee28f7f357c025f7b5cd7d1ccc8c7a:/services/api/lib/eventbus.rb diff --git a/services/api/lib/eventbus.rb b/services/api/lib/eventbus.rb index 96e9d04322..bccbeea4bb 100644 --- a/services/api/lib/eventbus.rb +++ b/services/api/lib/eventbus.rb @@ -78,6 +78,8 @@ class EventBus ws.filters.each do |filter| ft = record_filters filter.filters, Log if ft[:cond_out].any? + # Join the clauses within a single subscription filter with AND + # so it is consistent with regular queries cond_out << "(#{ft[:cond_out].join ') AND ('})" param_out += ft[:param_out] end @@ -85,7 +87,8 @@ class EventBus # Add filters to query if cond_out.any? - logs = logs.where(cond_id + " AND (#{cond_out.join ') OR ('})", *param_out) + # Join subscriptions with OR + logs = logs.where(cond_id + " AND ((#{cond_out.join ') OR ('}))", *param_out) else logs = logs.where(cond_id, *param_out) end @@ -126,7 +129,7 @@ class EventBus # Add a filter. This gets the :filters field which is the same # format as used for regular index queries. ws.filters << Filter.new(p) - ws.send ({status: 200, message: 'subscribe ok'}.to_json) + ws.send ({status: 200, message: 'subscribe ok', filter: p}.to_json) # Send any pending events push_events ws