-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return to previous date after block when in threadsafe mode #216
Conversation
Incidentally, something I'm a little unclear on here: Why is In other words, would it not make more sense to just make |
Gentle nudge towards getting this merged? I'm running exactly into this issue with |
@travisjeffery It'll be great if you can find some time to verify & merge this PR. |
I have also run into this exact problem when using |
Just curious if this question was answered. Seems like it should just be always threadsafe, no? |
I just encountered this and opened a duplicate bug report before I saw this: #216 |
Looking at the most recent shows this one character change is still not merged. Any chance it will get merged soon? |
I'm not aware of any reason not to merge this; it's just been sat here pending for over 3 years 😅 @joshuacronemeyer , thoughts? Deprecating |
I don't see why we shouldn't add this to 0.9.3. I do see the failed build for ruby 1.9.3 though and i can't seem to get these really old rubies running on my machine. I'll merge and hope the build passes. |
When is this change live on rubygems "timecop". Is it already? |
@Aryk It would require a version bump + release I've also just noticed this file: https://github.com/travisjeffery/timecop/blob/master/History.md ...so it would be good practice to make a note of changes like this in there before a release. (I guess I didn't notice it 3 years ago, as such a file is more commonly called Also, it seems there's one issue labelled as TODO before the next release (not sure how critical that is, though?) https://github.com/travisjeffery/timecop/milestone/3 |
I think that last issue should be an easy fix, so i'd like to get it in. I'll set a deadline for this weekend on the release so if no PR comes by the weekend we'll release without it. @tom-lord thanks for noticing the History file. If you have time to update it that would be appreciate and feel free to rename. |
The
thread_safe
option introduced to Timecopv0.9.0
(and still present inv0.9.1
) contains a major bug: The time is not automatically returned to its original state, whenTimecop.freeze
orTimecop.travel
are called with a block.The original PR for the feature actually worked fine, but was broken by this separate commit line, in this PR.
Minimal reproduction example (as seen from the test in this PR):
This bug only occurs in threadsafe mode.
The issue stems from a 1-character mistake: using
@stack
instead ofstack
. The latter calls this method:When
thread_safe
mode is enabled,@stack
remains an empty array - therefore the original time was not being returned to.