A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/thoughtbot/climate_control/issues/32 below:

Not multi-threaded safe · Issue #32 · thoughtbot/climate_control · GitHub

Using:

ClimateControl is not currently multi-threaded safe, and the documentation doesn't make this clear. Running ClimateControl within a Rake "multitask" causes all other parallel tasks to have the modified environment.

Here's a sample set of rake tasks that demonstrate the issue:

multitask :task1 do
  ClimateControl.modify(FOO: 'one') do
    puts "TASK1: #{ENV['FOO']}"
    sleep(3)
  end
end

multitask :task2 do
  sleep(1)
  puts "TASK2-middle: #{ENV['FOO']}"
  sleep(2.5)
  puts "TASK2-after: #{ENV['FOO']}"
end

multitask test: %i[task1 task2]

The expected output if it were multi-threaded safe would be:

TASK1: one
TASK2-middle:
TASK2-after:

But the real output is:

TASK1: one
TASK2-middle: one
TASK2-after:

Is the intent of the GEM to be multi-threaded safe? If not I think it should be clear on the documentation page.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4