SIGN IN SIGN UP

Await the blocked notification in the publish-cancellation test

TestCallerCancellationIsNotRecordedAsPublishFailure_GH1967 relied on
BlockAsync's fixed one-second settle time to have engaged the broker
memory alarm before it published. On a slow or loaded run the alarm
had not engaged yet, so the mandatory publish to a nonexistent queue
was returned as unroutable and the test saw PublishReturnException
instead of the OperationCanceledException it asserts.

Publish while blocked, then await the connection.blocked notification
before cancelling. The publish is what makes the broker send that
notification, and its arrival confirms the broker has stopped reading
the socket, so the publish is parked in the confirmation await and
cancelling the token deterministically throws OperationCanceledException
rather than racing an unroutable return.
L
Luke Bakken committed
142bfbfee8e86a2b7a4e011c4bf5950dd7ad8f0c
Parent: 767933c