Commit d20f5d76 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'fix-daemon-memory-killer-busy-loop-risk' into 'master'

Fix daemon memory killer busy loop risk

See merge request gitlab-org/gitlab!17888
parents 78e2ab01 4259b102
......@@ -39,8 +39,8 @@ module Gitlab
while enabled?
begin
restart_sidekiq unless rss_within_range?
sleep(CHECK_INTERVAL_SECONDS)
restart_sidekiq unless rss_within_range?
rescue => e
log_exception(e, __method__)
rescue Exception => e # rubocop:disable Lint/RescueException
......
......@@ -40,6 +40,7 @@ describe Gitlab::SidekiqDaemon::MemoryKiller do
message: "Exception from start_working: My Exception")
expect(memory_killer).to receive(:rss_within_range?).twice.and_raise(StandardError, 'My Exception')
expect(memory_killer).to receive(:sleep).twice.with(Gitlab::SidekiqDaemon::MemoryKiller::CHECK_INTERVAL_SECONDS)
expect { subject }.not_to raise_exception
end
......@@ -53,6 +54,7 @@ describe Gitlab::SidekiqDaemon::MemoryKiller do
expect(memory_killer).to receive(:rss_within_range?).once.and_raise(Exception, 'My Exception')
expect(memory_killer).to receive(:sleep).with(Gitlab::SidekiqDaemon::MemoryKiller::CHECK_INTERVAL_SECONDS)
expect(Sidekiq.logger).to receive(:warn).once
.with(
class: described_class.to_s,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment