Skip to content

fix: make runUntilDate not system aware #1050

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

codeskyblue
Copy link

No description provided.

Copy link

linux-foundation-easycla bot commented Aug 14, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@codeskyblue
Copy link
Author

related to #1045

@mykola-mokhnach
Copy link

Could you please describe the purpose of this PR and the problem it solves?

@mykola-mokhnach mykola-mokhnach changed the title make runUntilDate not system aware chore: make runUntilDate not system aware Aug 14, 2025
@codeskyblue
Copy link
Author

#1045

Resolve. #1045

#import <Foundation/Foundation.h>

@interface NSRunLoop (Monotonic)
- (void)runForMonotonicInterval:(NSTimeInterval)seconds;

Choose a reason for hiding this comment

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

Could you please add a docstring to the public interface method?

@mykola-mokhnach mykola-mokhnach changed the title chore: make runUntilDate not system aware fix: make runUntilDate not system aware Aug 15, 2025
- (void)runForMonotonicInterval:(NSTimeInterval)seconds {
CFTimeInterval end = CACurrentMediaTime() + seconds;
while (CACurrentMediaTime() < end) {
[self runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
Copy link
Member

@KazuCocoa KazuCocoa Aug 16, 2025

Choose a reason for hiding this comment

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

Can your issue be resolved with:

Suggested change
[self runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
[self runMode:NSRunLoopCommonModes beforeDate:[NSDate distantFuture]];

? @codeskyblue

It looks like the default mode could block some actions such as UI tracking. I observed this blocking behavior in testGetPasteboard's fb_typeText method for example. It caused many timeouts in tests (e.g. https://dev.azure.com/AppiumCI/Appium%20CI/_build/results?buildId=30265&view=results).

https://stackoverflow.com/questions/7222449/nsdefaultrunloopmode-vs-nsrunloopcommonmodes

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.

3 participants