Fixed bug, when redis spop returns a string and it is being compared to an integer

This commit is contained in:
Wedge 2016-02-02 21:40:02 +03:00
parent 02c75bc8af
commit 881cae6afa
1 changed files with 2 additions and 2 deletions

View File

@ -618,7 +618,7 @@ class BuildList < ActiveRecord::Base
end end
def self.next_build_from_queue(set, arch_ids, platform_ids) def self.next_build_from_queue(set, arch_ids, platform_ids)
kind_id = Redis.current.spop(set) kind_id = Redis.current.spop(set).to_i
key = key =
case set case set
when USER_BUILDS_SET when USER_BUILDS_SET
@ -630,7 +630,7 @@ class BuildList < ActiveRecord::Base
task = Resque.pop(key) if key task = Resque.pop(key) if key
if task || Redis.current.llen("resque:queue:#{key}") > 0 if task || Redis.current.llen("resque:queue:#{key}") > 0
Redis.current.sadd(set, kind_id) Redis.current.sadd(set, kind_id.to_s)
end end
build_list = BuildList.where(id: task['args'][0]['id']).first if task build_list = BuildList.where(id: task['args'][0]['id']).first if task