aboutsummaryrefslogtreecommitdiffstats
path: root/collector_proxy/lib/event_channel.rb
diff options
context:
space:
mode:
Diffstat (limited to 'collector_proxy/lib/event_channel.rb')
-rw-r--r--collector_proxy/lib/event_channel.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/collector_proxy/lib/event_channel.rb b/collector_proxy/lib/event_channel.rb
index 5c394c2..55fdebd 100644
--- a/collector_proxy/lib/event_channel.rb
+++ b/collector_proxy/lib/event_channel.rb
@@ -2,7 +2,7 @@ class EventChannel
class << self
def setup
return if @dalli
- @dalli = Dalli::Client.new(Settings.memcached, namespace: "aclog-collector-proxy:")
+ @dalli = Dalli::Client.new(Settings.memcached, namespace: "aclog-collector-proxy")
@queue = []
@subscribers = {}
end
@@ -10,11 +10,13 @@ class EventChannel
def push(data)
raise ScriptError, "Call EventChannel.setup first" unless @dalli
if id = data[:identifier]
- if @dalli.get(id)
- CollectorProxy.logger.debug("UniqueChannel") { "Duplicate event: #{id}" }
+ key, val = id.split("#", 2)
+ cur = @dalli.get(key)
+ if cur && (!val || (cur <=> val) > -1)
+ CollectorProxy.logger.debug("UniqueChannel") { "Duplicate event: #{key}" }
return
else
- @dalli.set(id, true)
+ @dalli.set(key, val || true)
end
end
if @subscribers.size > 0