diff --git a/lib/datadog/core/remote/component.rb b/lib/datadog/core/remote/component.rb index e325fb0db9e..3763fa288f5 100644 --- a/lib/datadog/core/remote/component.rb +++ b/lib/datadog/core/remote/component.rb @@ -139,9 +139,7 @@ def wait_once(timeout = nil) # Since @once only ever goes from false to true, this is semantically valid return :pass if @once - begin - @mutex.lock - + @mutex.synchronize do return :pass if @once now = Core::Utils::Time.get_time @@ -184,13 +182,11 @@ def wait_once(timeout = nil) # technically permitted; second and subsequent calls have no # effect. def lift - @mutex.lock + @mutex.synchronize do + @once ||= true - @once ||= true - - @condition.broadcast - ensure - @mutex.unlock + @condition.broadcast + end end end