Sha256: 71545742ebcbb980c2813c27f22c63aeb712c7e11fcd15329107d56448f18bb9
Contents?: true
Size: 522 Bytes
Versions: 3
Compression:
Stored size: 522 Bytes
Contents
class WatchKeyTask < Task def type_name 'Watch key' end def perform result = RetrieveKey.new(backend, trigger).result if data[:initialized] notify(data[:old_value], result) if data[:old_value] != result else data[:initialized] = true end data[:old_value] = result save end def notify(old_value, new_value) msg = "Value of key '#{trigger}' has changed from #{old_value.inspect} to #{new_value.inspect}" Notification.create(reporter: name, message: msg) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redis_monitor-0.3.3 | lib/engine/app/models/watch_key_task.rb |
redis_monitor-0.3.2 | lib/engine/app/models/watch_key_task.rb |
redis_monitor-0.3 | lib/engine/app/models/watch_key_task.rb |