14 lines
239 B
Ruby
14 lines
239 B
Ruby
![]() |
module Gitlab
|
||
|
module OptimisticLocking
|
||
|
def retry_lock(subject, &block)
|
||
|
while true do
|
||
|
begin
|
||
|
return yield subject
|
||
|
rescue StaleObjectError
|
||
|
subject.reload
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|