Repository navigation
chore(ad-hoc): remove AsyncSemaphore - #543
Merged
Merged
Conversation
…b authentication session
…h serial decorator
vitalii-vanziak-cko
previously approved these changes
Oct 27, 2026
andrii-vysotskyi-cko
dismissed
vitalii-vanziak-cko’s stale review
via
October 27, 2026 12:15
f8baaf9
vitalii-vanziak-cko
approved these changes
Oct 27, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
AsyncSemaphoreis flaky:signal()bumped the counter and resumed the oldest waiter in two steps, so a reentrantwait()could take the permit in between and leave the resumed waiter with a negative count. Instead of fixing it, this PR removes it and replaces each of the three usages with a structure that fits the call site.ThrottledWebAuthenticationSessionDecoratorserialises authentications through a task chain: each call awaits the previously enqueued task before running. Cancellation while queued is observed once the predecessor completes.DefaultCustomerActionsServiceno longer holds concurrency state. Serialisation moved to a newSerialCustomerActionsServiceDecoratorusing the same chain, wired inProcessOut. Its job is to protect the merchant'sPO3DS2Servicefrom overlapping fingerprint and challenge calls.PONetcetera3DS2Servicereplaces both semaphores with an explicit state (idle,authenticating,ready,challenging,cleaning). Overlapping calls on an instance are rejected as a developer error,clean()during an in-flight operation is ignored with a warning, and a failed authentication tears down what it created and returns toidle. The static cross-instance guard is gone; the SDK's intolerance of concurrent use is documented instead.AsyncSemaphore,AsyncSemaphoreSuspension, and their tests are deleted.