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

Timer which pause when human checker is running #93

Merged
merged 3 commits into from
Nov 18, 2022
Merged

Conversation

swanandx
Copy link
Collaborator

@swanandx swanandx commented Nov 18, 2022

We use AtomicBool and channels to implement this hacky timer.
This is Work in Progress. TODOs:

  • Get timeout duration from config
  • Change return type to return an TimeOutError ??

Copy link
Owner

@bee-san bee-san left a comment

Choose a reason for hiding this comment

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

Also todo:

            recv(result_recv) -> exit_result => {
                 // if we find an element that matches our exit condition, return it!
                 // technically this won't check if the initial string matches our exit condition
                 // but this is a demo and i'll be lazy :P
                 let exit_result = exit_result.ok(); // convert Result to Some
                 if exit_result.is_some() {
                     trace!("Found exit result: {:?}", exit_result);
                     return exit_result;
                 }
             },
             recv(timer) -> _ => {
                 error!("TIMEOUT!!!");
                 return None;
             },

@bee-san bee-san merged commit 7f45b18 into main Nov 18, 2022
@delete-merged-branch delete-merged-branch bot deleted the channel-timer branch November 18, 2022 10:59
@SkeletalDemise SkeletalDemise mentioned this pull request Nov 18, 2022
@bee-san bee-san mentioned this pull request Nov 18, 2022
5 tasks
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