Skip to content

Commit

Permalink
Avoid request to be blocked once the "dispose" method has been called (
Browse files Browse the repository at this point in the history
…#1196)

* fix(AutoCollectHttpRequests): Avoid to block request after "dispose" called

* ref(AutoCollectHttpRequests): Remove useless control done few lines above

---------

Co-authored-by: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com>
  • Loading branch information
Apokalypt and hectorhdzg authored Sep 6, 2023
1 parent 4034bb0 commit aaafbfd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions AutoCollection/HttpRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ class AutoCollectHttpRequests {
CorrelationContextManager.wrapEmitter(response);
const shouldCollect: boolean = request && !(<any>request)[AutoCollectHttpRequests.alreadyAutoCollectedFlag];

if (request && shouldCollect) {
AutoCollectHttpRequests.INSTANCE?._registerRequest(request, response, onRequest)
if (request && shouldCollect && AutoCollectHttpRequests.INSTANCE) {
AutoCollectHttpRequests.INSTANCE._registerRequest(request, response, onRequest)
} else {
if (typeof onRequest === "function") {
onRequest(request, response);
}
onRequest(request, response);
}
}
};
Expand Down

0 comments on commit aaafbfd

Please sign in to comment.