FIX: Backup didn't work anymore after a running backup was canceled

This commit is contained in:
Gerhard Schlager 2020-10-13 16:41:43 +02:00 committed by Gerhard Schlager
parent 8c77b84aac
commit 1febf11362
3 changed files with 13 additions and 0 deletions

View File

@ -96,6 +96,8 @@ module BackupRestore
end
def listen_for_shutdown_signal
BackupRestore.clear_shutdown_signal!
Thread.new do
while BackupRestore.is_operation_running?
exit if BackupRestore.should_shutdown?

View File

@ -44,6 +44,8 @@ module BackupRestore
end
def listen_for_shutdown_signal
BackupRestore.clear_shutdown_signal!
Thread.new do
while BackupRestore.is_operation_running?
exit if BackupRestore.should_shutdown?

View File

@ -69,6 +69,15 @@ describe BackupRestore::SystemInterface do
thread.join
end.to raise_error(SystemExit)
end
it "clears an existing shutdown signal before it starts to listen" do
BackupRestore.set_shutdown_signal!
expect(BackupRestore.should_shutdown?).to eq(true)
thread = subject.listen_for_shutdown_signal
expect(BackupRestore.should_shutdown?).to eq(false)
Thread.kill(thread)
end
end
describe "#pause_sidekiq" do