[Event Hubs] Update send operation to include initialization#4319
[Event Hubs] Update send operation to include initialization#4319ramya0820 merged 27 commits intoAzure:masterfrom
Conversation
…perationTimeoutError
There was a problem hiding this comment.
@ramya0820 Am curious as to why we need 2 promises in the first place. Did you try having a single promise?
I would have imagined the older send function to include the below before attempting to send the event would have done the trick.
if (!this.isOpen()) {
await defaultLock.acquire(this.senderLock, this._init).catch(reject);
}
Agree, so I wasn't aware that converting func to
About this, the |
chradek
left a comment
There was a problem hiding this comment.
This looks good to me, can you confirm the tests are passing?
chradek
left a comment
There was a problem hiding this comment.
One change requested: call setTimeout before the init logic.
|
Looks like build is failing because you removed the use of an imported method, but didn't remove the import. |
ramya-rao-a
left a comment
There was a problem hiding this comment.
Please resolve the merge conflict, trigger a round of live tests and then merge the PR
| const waitTimer = setTimeout( | ||
| actionAfterTimeout, | ||
| getRetryAttemptTimeoutInMs(options.retryOptions) | ||
| ); |
There was a problem hiding this comment.
Due to the re-arrangement of the timer, if if (abortSignal && abortSignal.aborted) below returns true, then we end up returning a rejected promise (which is right) without clearing the timer.
Please consider keeping the previous order of the callbacks/helper-functions and only adding the link creation part at the right place
There was a problem hiding this comment.
The ordering in the recent commit of eaaf17e is better, but still needs work.
In the current setup, if the abort signal is fired when the async process of init() is in progress, then the promise is being rejected only after init() is complete. This is because init() is being called before the event handler for abort event was added.
Please make the below changes
- Add the event handler for abort before calling init() and before starting the timer
- Remove the event handler for abort before rejecting the promise when
init()fails
There was a problem hiding this comment.
#4322 (comment) thread specifically clarifies about abort during init().
This scenario if we want to address would then need to apply for the managementRequest as well correct? Or did we specifically exclude this because of complexity involved? (In not having access to removeListeners() on sender link from the SDK?) It just feels like UX is not consistent in both cases.
Okay to implement the optimization and new corner cases from this.
There was a problem hiding this comment.
This scenario applies to managementRequest as well i.e. the scenario of abort signal being fired when the async process of init() is in progress.
I have updated the comment thread for managementRequest. Please see https://github.com/Azure/azure-sdk-for-js/pull/4322/files#r305599979
|
/azp run js - eventhubs-client - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
For more context refer to #2835