MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / flushIn

Function flushIn

packages/core/src/transports/offline.ts:97–120  ·  view source on GitHub ↗
(delay: number)

Source from the content-addressed store, hash-verified

95 }
96
97 function flushIn(delay: number): void {
98 if (flushTimer) {
99 clearTimeout(flushTimer as ReturnType<typeof setTimeout>);
100 }
101
102 // We need to unref the timer in node.js, otherwise the node process never exit.
103 flushTimer = safeUnref(
104 setTimeout(async () => {
105 flushTimer = undefined;
106
107 const found = await store.shift();
108 if (found) {
109 log('Attempting to send previously queued event');
110
111 // We should to update the sent_at timestamp to the current time.
112 found[0].sent_at = new Date(safeDateNow()).toISOString();
113
114 void send(found, true).catch(e => {
115 log('Failed to retry sending', e);
116 });
117 }
118 }, delay),
119 ) as Timer;
120 }
121
122 function flushWithBackOff(): void {
123 if (flushTimer) {

Callers 3

flushWithBackOffFunction · 0.85
sendFunction · 0.85
makeOfflineTransportFunction · 0.85

Calls 7

safeUnrefFunction · 0.90
safeDateNowFunction · 0.90
setTimeoutFunction · 0.85
shiftMethod · 0.80
logFunction · 0.70
sendFunction · 0.70
catchMethod · 0.65

Tested by

no test coverage detected