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

convert waiter from file monitor to timer/ticker combination #985

Closed
gabemontero opened this issue Jan 19, 2022 · 1 comment
Closed

convert waiter from file monitor to timer/ticker combination #985

gabemontero opened this issue Jan 19, 2022 · 1 comment
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Comments

@gabemontero
Copy link
Member

We could maximize code reuse, via golang constructs of Timer and Ticker, and convert cmd/waiter/waiter.go from #934 and its loop on the PID file maintenance.

Instead, you can have a single select with cases for both the Timer and Ticker.

  1. the Timer would capture the current timeout capability. If it pops, it stops/cancels the Ticker, and the waiter gracefully exits having timed out / quit waiting for the condition to complete.
  2. the waiter's Done method that is called when the "condition" is achieved calls the Ticker cancel/stop, and that event leads to a stop/cancel of the Timer, and the waiter gracefully exits, have successfully waited for its desired condition.

See the thread starting at #934 (comment) for more details

@gabemontero gabemontero added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jan 19, 2022
@gabemontero gabemontero self-assigned this Jan 20, 2022
@gabemontero
Copy link
Member Author

OK after having looked at the merged code in my editor (easier for me to visualize than github PR code diff presentation :-) ) and better seeing/realizing the multi process nature of waiter start then waiter done, I now realize this change is really untenable. Certainly if we constructed a multiple process communication to facilitate the timer/ticker, it would be no simpler than the current file based approach.

closing

@otaviof FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

No branches or pull requests

1 participant