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

Queue notifications in an async stream instead of blocking forward progress. #2946

Closed
wants to merge 1 commit into from

Conversation

pixlwave
Copy link
Member

@pixlwave pixlwave commented Jun 19, 2024

#2944 introduced a DispatchSemaphore within a Task. Whilst that actual usage wouldn't cause an issue as the await time would be minimal in what is essentially a serial process, we should still follow the rules that all threads should be making forward progress. This PR replaces the semaphore with an async stream to handle notifications in a queue, 1-by-1.

This provides a slightly nicer separation of concerns although now I'm looking at the structure of the NSE, it would be nice to go further and break out the run method into its own type too that owns the contentHandler and modifiedContent properties.

@pixlwave pixlwave requested a review from a team as a code owner June 19, 2024 18:40
@pixlwave pixlwave requested review from stefanceriu and removed request for a team June 19, 2024 18:40
Copy link

Copy link

Warnings
⚠️ Please add a changelog.
⚠️ Some of the commits are missing ticket numbers. Please consider squashing all commits that don't have a tracking number.

Generated by 🚫 Danger Swift against a204f6b

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 0% with 34 lines in your changes missing coverage. Please review.

Project coverage is 77.97%. Comparing base (23b0cde) to head (a204f6b).

Files Patch % Lines
NSE/Sources/NotificationServiceExtension.swift 0.00% 34 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2946      +/-   ##
===========================================
+ Coverage    77.92%   77.97%   +0.04%     
===========================================
  Files          691      691              
  Lines        54048    54045       -3     
===========================================
+ Hits         42116    42140      +24     
+ Misses       11932    11905      -27     
Flag Coverage Δ
unittests 69.04% <0.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stefanceriu stefanceriu deleted the doug/lets-not-use-semaphores branch July 23, 2024 09:45
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