Skip to content

Commit

Permalink
fix:Race condition on instance variable assignment (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc authored Aug 31, 2020
1 parent aede812 commit 3bb7f74
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/ddtrace/workers/async.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def terminate
end

def run_async?
@run_async = false unless instance_variable_defined?(:@run_async)
return false unless instance_variable_defined?(:@run_async)
@run_async == true
end

Expand All @@ -55,7 +55,7 @@ def running?
end

def error?
@error = nil unless instance_variable_defined?(:@error)
return false unless instance_variable_defined?(:@error)
!@error.nil?
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ddtrace/workers/loop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def work_pending?
end

def run_loop?
@run_loop = false unless instance_variable_defined?(:@run_loop)
return false unless instance_variable_defined?(:@run_loop)
@run_loop == true
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ddtrace/workers/polling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def stop(force_stop = false, timeout = SHUTDOWN_TIMEOUT)
end

def enabled?
@enabled = true unless instance_variable_defined?(:@enabled)
return true unless instance_variable_defined?(:@enabled)
@enabled
end

Expand Down

0 comments on commit 3bb7f74

Please sign in to comment.