Put out schedule_to_db from inclock to avoid deadlock

This commit is contained in:
Shinya Maeda 2018-04-18 14:12:43 +09:00
parent d5740846f6
commit 731118d349
1 changed files with 4 additions and 3 deletions

View File

@ -32,9 +32,9 @@ module Ci
end
def set_data(value)
in_lock do
raise ArgumentError, 'too much data' if value.bytesize > CHUNK_SIZE
raise ArgumentError, 'too much data' if value.bytesize > CHUNK_SIZE
in_lock do
if redis?
redis_set_data(value)
elsif db?
@ -44,8 +44,9 @@ module Ci
end
save! if changed?
schedule_to_db if fullfilled?
end
schedule_to_db if fullfilled?
end
def truncate(offset = 0)