lib/weeter/plugins/subscription/redis.rb in weeter-0.11.0 vs lib/weeter/plugins/subscription/redis.rb in weeter-0.13.0
- old
+ new
@@ -9,23 +9,27 @@
def initialize(client_app_config)
@config = client_app_config
end
def get_initial_filters(&block)
- redis.get(@config.subscriptions_key) do |value|
+ deferred_get = redis.get(@config.subscriptions_key) do |value|
if value.nil?
raise "Expected to find subscription data at redis key #{@config.subscriptions_key}"
end
yield MultiJson.decode(value)
end
+ deferred_get.errback do |message|
+ Weeter.logger.error(message)
+ end
end
def listen_for_filter_update(tweet_consumer)
pub_sub_redis.subscribe(@config.subscriptions_changed_channel)
pub_sub_redis.on(:message) do |channel, message|
Weeter.logger.info [:message, channel, message]
- Weeter.logger.info("Reconnecting Twitter stream")
+ Weeter.logger.info("Retrieving updated filters from redis")
get_initial_filters do |filter_params|
+ Weeter.logger.info("Triggering reconnect Twitter stream with new filters")
tweet_consumer.reconnect(filter_params)
end
end
end