Skip to content
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

allow context cancellation in WAIT #524

Merged
merged 2 commits into from
Jun 1, 2020

Conversation

Pangoraw
Copy link
Contributor

@Pangoraw Pangoraw commented May 29, 2020

While investigating issue #518, I noticed that when pressing CTRL+C during WAIT() would not cause the program to stop instantly, but only at the end of the duration. You can now press CTRL+C when waiting and the stopping will happen instantly.

NOTE: I am not sure about the error message and whether or not I should add a test.

@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #524 into master will increase coverage by 0.0%.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master    #524   +/-   ##
======================================
  Coverage    41.8%   41.9%           
======================================
  Files         243     243           
  Lines        9069    9069           
======================================
+ Hits         3793    3797    +4     
+ Misses       4918    4916    -2     
+ Partials      358     356    -2     

pkg/stdlib/utils/wait.go Outdated Show resolved Hide resolved
Copy link
Member

@ziflex ziflex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost perfect :)

@ziflex
Copy link
Member

ziflex commented May 29, 2020

Good catch!

@Pangoraw Pangoraw force-pushed the fix/cancellation-wait branch from fa420a7 to e81250c Compare June 1, 2020 09:11
@Pangoraw Pangoraw requested a review from ziflex June 1, 2020 09:12
@Pangoraw Pangoraw force-pushed the fix/cancellation-wait branch from 057a199 to 70650cd Compare June 1, 2020 10:08
@Pangoraw
Copy link
Contributor Author

Pangoraw commented Jun 1, 2020

This test started to fail randomly because the error message was changing from either core.ErrTerminated to context canceled: WAIT(1000). So in order to make sure the context was already canceled, I cancel it before running the program (see 70650cd).

@ziflex ziflex merged commit aa058f3 into MontFerret:master Jun 1, 2020
@Pangoraw Pangoraw deleted the fix/cancellation-wait branch June 1, 2020 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants