From 92f0c6537c9509840fb4645564e9a47f575a6d46 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Tue, 7 Jan 2014 14:31:54 -0500 Subject: [PATCH] FIX: version check job when no versions are returned in json --- lib/discourse_updates.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/discourse_updates.rb b/lib/discourse_updates.rb index 725ed6c8723..c456ce80276 100644 --- a/lib/discourse_updates.rb +++ b/lib/discourse_updates.rb @@ -80,15 +80,18 @@ module DiscourseUpdates $redis.del(missing_versions_list_key) end - # store the list in redis - version_keys = [] - versions[0,5].each do |v| - key = "#{missing_versions_key_prefix}:#{v['version']}" - $redis.mapped_hmset key, v - version_keys << key + if versions.present? + # store the list in redis + version_keys = [] + versions[0,5].each do |v| + key = "#{missing_versions_key_prefix}:#{v['version']}" + $redis.mapped_hmset key, v + version_keys << key + end + $redis.rpush missing_versions_list_key, version_keys end - $redis.rpush missing_versions_list_key, version_keys - versions + + versions || [] end def missing_versions