Commit 57cd99f
authored
[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#L811 parent 912ed6f commit 57cd99f
File tree
3 files changed
+50
-29
lines changed- sdk/servicebus/service-bus
- src
- session
3 files changed
+50
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
Lines changed: 47 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
265 | 304 | | |
266 | 305 | | |
267 | 306 | | |
| |||
274 | 313 | | |
275 | 314 | | |
276 | 315 | | |
277 | | - | |
| 316 | + | |
278 | 317 | | |
279 | 318 | | |
280 | 319 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 320 | + | |
297 | 321 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 322 | + | |
307 | 323 | | |
308 | 324 | | |
309 | 325 | | |
| |||
371 | 387 | | |
372 | 388 | | |
373 | 389 | | |
| 390 | + | |
374 | 391 | | |
375 | 392 | | |
376 | 393 | | |
| |||
444 | 461 | | |
445 | 462 | | |
446 | 463 | | |
| 464 | + | |
447 | 465 | | |
448 | 466 | | |
449 | 467 | | |
| |||
0 commit comments