DEV: Fix randomly failing test.

Even if a thread is alive in the loop check, it may be dead by the
time `Thread#wakeup` is called on it.
This commit is contained in:
Guo Xiang Tan 2019-02-19 13:33:34 +08:00
parent 83f13ecf82
commit adbc87857e
1 changed files with 8 additions and 1 deletions

View File

@ -61,7 +61,14 @@ class SidekiqPauser
if t = @extend_lease_thread
@extend_lease_thread = nil
while t.alive?
begin
t.wakeup
rescue ThreadError => e
unless e.message =~ /killed thread/
raise e
end
end
sleep 0
end
end