Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make
require 'timecop'
a bit more threadsafe
Every few hundred runs of our application we are seeing something like: ``` 22:27:36 NameError: uninitialized constant #<Class:Time>::Timecop 22:27:36 /build/vendor/bundle/ruby/2.4.0/gems/timecop-0.9.1/lib/timecop/time_extensions.rb:7:in `mock_time' 22:27:36 /build/vendor/bundle/ruby/2.4.0/gems/timecop-0.9.1/lib/timecop/time_extensions.rb:14:in `now_with_mock_time' ... ``` I think this is because we are running multiple ruby `Thread`s, and one thread is doing `require 'timecop'` and is interrupted after monkeypatching `Time` but before creating the `TimeCop` constant. We should do the monkeypatching after the constant is available.
- Loading branch information