Exit after failed connection to Redis

This commit is contained in:
suckatrash 2022-03-26 23:07:15 -07:00
parent 3b6073933e
commit b4e89cd6cb
No known key found for this signature in database
GPG key ID: 1A9EE78B881BED99
2 changed files with 3 additions and 2 deletions

View file

@ -1657,8 +1657,9 @@ module Vmpooler
end end
end end
rescue Redis::CannotConnectError => e rescue Redis::CannotConnectError => e
$logger.log('s', "Cannot connect to the redis server: #{e}") $logger.log('s', "Cannot connect to the redis server, Exiting!!!: #{e}")
raise raise
exit 1
end end
end end
end end

View file

@ -3319,7 +3319,7 @@ EOT
redis_connection_pool.with do |redis| redis_connection_pool.with do |redis|
expect(redis).to receive(:set).with('vmpooler__tasks__clone', 0).and_raise(Redis::CannotConnectError) expect(redis).to receive(:set).with('vmpooler__tasks__clone', 0).and_raise(Redis::CannotConnectError)
end end
expect(logger).to receive(:log).with('s', 'Cannot connect to the redis server: Redis::CannotConnectError') expect(logger).to receive(:log).with('s', 'Cannot connect to the redis server, Exiting!!!: Redis::CannotConnectError')
expect{subject.execute!(maxloop,0)}.to raise_error Redis::CannotConnectError expect{subject.execute!(maxloop,0)}.to raise_error Redis::CannotConnectError
end end