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

Remove background correction in AsyncTimerSequence #289

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

FranzBusch
Copy link
Member

Motivation

Currently, the AsyncTimerSequence is trying to correct for when an application becomes suspended and the timer might fire multiple times once the application gets foregrounded again.

However, this is already handled by the Clock types themselves. The SuspendingClock is correcting for suspension of the app whereas the ContinuousClock is not.

Additionally, this was not only hit by background an application but by just calling Task.sleep in the for-await loop that is consuming the sequence.

Modification

This removes the part of the code in AsyncTimerSequence which corrected for suspension of the application.

# Motivation
Currently, the `AsyncTimerSequence` is trying to correct for when an application becomes suspended and the timer might fire multiple times once the application gets foregrounded again.

However, this is already handled by the `Clock` types themselves. The `SuspendingClock` is correcting for suspension of the app whereas the `ContinuousClock` is not.

Additionally, this was not only hit by background an application but by just calling `Task.sleep` in the for-await loop that is consuming the sequence.

# Modification
This removes the part of the code in `AsyncTimerSequence` which corrected for suspension of the application.
@FranzBusch FranzBusch requested a review from phausler August 25, 2023 12:19
@FranzBusch FranzBusch added the v1.0 Work leading up first API stable version label Aug 25, 2023
@FranzBusch
Copy link
Member Author

@swift-ci please test

1 similar comment
@FranzBusch
Copy link
Member Author

@swift-ci please test

@FranzBusch FranzBusch merged commit 6dfbfd5 into apple:main Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.0 Work leading up first API stable version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants