-
Notifications
You must be signed in to change notification settings - Fork 12
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
Ensure network monitor path update handler is called on start #199
Merged
mokagio
merged 7 commits into
trunk
from
ensure-network-monitor-update-handler-is-called-on-start
Mar 21, 2022
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e62c10d
Use `self.` over ivar access for `networkMonitor` for consistency
mokagio c3cd4bf
Move a `weakSelf` definition closer to its usage
mokagio 5e4240a
Remove a double space — One is enough :)
mokagio 06c638b
Add a queue on which to execute the network monitor event handlers
mokagio 0867adf
Explicitly set 0 as the relative priority for the network path monito…
mokagio d607bdc
Use `dispatch_queue_create_with_target` for network path monitor
mokagio 528e9a5
Merge 'origin/trunk' into ensure-network-monitor-update-handler-is-ca…
mokagio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apple's docs (and various Apple engineers) recommend using
dispatch_queue_create_with_target
instead to create a serial queue that will target one of the existing concurrent views, rather than creating a new root queue. Creating a root queue will usually result in a permanent thread dedicated to this queue, which is definitely overkill for this particular use case.Bonus: if we use the
target
API, then I don't think we need to create theattrs
above at all.I really wish this were documented better, but it's not. It's all in WWDC videos and Twitter lore from Apple engineers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bjhomer, I tried this approach but it behaved as before: When the demo app launches, the update handler block is not called.
I pushed that version to a dedicated branch if you want to play with it 2ca8b3b .
In the meantime, I applied your other suggestion and verified it works following the manual script from the PR description.
What do you think of merging this version in, so we can ship the fix in WordPress 19.5, which is scheduled for the coming Monday, and then figure out why the code that Apple recommends doesn't work?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mokagio I just checked out 2ca8b3b. It looks like it's missing a call to
network_monitor_set_queue
, which is probably why it wasn't working. I added in that call and verified that it does hit the breakpoint upon launch.If you'd rather merge in this version, though, I'm willing to accept that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bjhomer 🤦♂️... I had a feeling I missed something, but couldn't put my finger on it.
I incorporated your suggestion and verified it worked, as you said 🎉 Thanks!
Given my track record in this PR, I dismissed your review and asked for a new one. Much appreciated 🙇♂️