Skip to content

Commit

Permalink
chore(ama-sdk): add logs on timeout cancellation/restart (#1574)
Browse files Browse the repository at this point in the history
## Proposed change

<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that is required for this change. -->

## Related issues

- 🐛 Fixes #(issue)
- 🚀 Feature #(issue)

<!-- Please make sure to follow the contributing guidelines on
https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
  • Loading branch information
cpaulve-1A authored Mar 29, 2024
2 parents 35b60cd + c6fb524 commit 348b829
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/@ama-sdk/core/src/plugins/timeout/timeout.fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ export class TimeoutFetch implements FetchPlugin {
const timerCallback = (pauseStatus: TimeoutStatus) => {
if (timer && pauseStatus === 'timeoutStopped') {
clearTimeout(timer);
(context.logger || console).log('[SDK Plugins] Timeout cancelled.');
timer = undefined;
} else if (!timer && pauseStatus === 'timeoutStarted') {
timer = setTimeout(timeoutCallback, this.timeout);
(context.logger || console).log('[SDK Plugins] Timeout restarted.');
}
};
this.timerSubscription.push(timerCallback);
Expand Down

0 comments on commit 348b829

Please sign in to comment.