forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ServiceBus] throw error earlier when timing out (Azure#27308)
Related: issue #9775, Azure#27010 This PR fixed the following timing issue when trying to establish link for next session but there are none available. what's happening is - SDK is trying to create a link for next avaiable session (`options.source.filter: { com.microsoft:session-filter': undefined }`) - Because no sessions are available, after one minute, a link is established, but with `"source":null,"target":null`. The call to create link resolves. - However, the service immediately use that link to ask SDK to close the link, with an error of `"com.microsoft:timeout"`/`The operation did not complete within the allotted timeout of 00:00:59.9130000.` - SDK respects the request and start acquiring a lock to close the link - Meanwhile, SDK gets a link, nice! It will continue as the link has been created - SDK gets lock to close link and sets `this._link` to `undefined` and start closing receiver and amqp session - SDK null-check the link and throws INTERNAL ERROR Instead of returning the link in this case, This PR checks whether we got a session id back. If not and there's an error from service, we rethrow the error. Some of the existing error handling is also moved before returning the link, instead of afterwards. ### Are there test cases added in this PR? _(If not, why?)_ There's one test covers this scenario and verifies two possible errors. https://github.com/Azure/azure-sdk-for-js/blob/28cbcd053daabb7f86816014d8cb8f8004bbc18f/sdk/servicebus/service-bus/test/public/sessionsTests.spec.ts#L81
- Loading branch information
1 parent
912ed6f
commit 57cd99f
Showing
3 changed files
with
50 additions
and
29 deletions.
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
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
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