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

Use boot-time for sleep #23

Closed
wants to merge 2 commits into from
Closed

Use boot-time for sleep #23

wants to merge 2 commits into from

Conversation

Tokarak
Copy link
Contributor

@Tokarak Tokarak commented Jan 15, 2024

Boot-time: "This library reimplements std::time::Instant to use suspend-aware monotonic time if target system supports it.
Otherwise it uses monotonic time or reexports std::time::Instant."

Will be obsoleted when tokio-rs/tokio#3185 is resolved.

Fixes #22

Boot-time: "This library reimplements std::time::Instant to use suspend-aware monotonic time if target system supports it.
Otherwise it uses monotonic time or reexports std::time::Instant."

Will be obsoleted when tokio-rs/tokio#3185 is resolved.

Fixes redlib-org#22
@Tokarak
Copy link
Contributor Author

Tokarak commented Jan 15, 2024

Testing this on MacOS for the efficacy of the fix.

@Tokarak
Copy link
Contributor Author

Tokarak commented Jan 16, 2024

Hasn't worked yet. Please wait until the next commit.

@sigaloid
Copy link
Member

Another alternative to this would be to simply loop and check if the time had elapsed... Checking every minute for the current time won't take any more than a minuscule fraction of CPU time, and would handle suspends gracefully without relying on platform primitives. It also avoids the problem of figuring out when the auth token is expired and handling it out-of-band.

@Tokarak
Copy link
Contributor Author

Tokarak commented Jan 22, 2024

Actually, it DOES work! I've had an instance running for three a days now; no error. The previous error must be due to some other cause? Restarting the instance to double check.
edit: or not...

@Tokarak Tokarak marked this pull request as ready for review January 22, 2024 16:19
@Tokarak Tokarak marked this pull request as draft January 23, 2024 21:15
@sigaloid
Copy link
Member

Going to close this for now - as per most recent comment in linked issue, this occurs sometimes completely unrelatedly to boot time not counting towards timer, so this fix isn't going to be enough - we need to catch auth errors and force a refresh (which will fix this problem coincidentally).

@Tokarak Tokarak closed this Jan 28, 2024
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.

🐛 Bug Report: "Unauthorized"; fixed by restarting instance.
2 participants