Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/libs/actions/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Performance from '@libs/Performance';
import {isPublicRoom, isValidReport} from '@libs/ReportUtils';
import {isLoggingInAsNewUser as isLoggingInAsNewUserSessionUtils} from '@libs/SessionUtils';
import {clearSoundAssetsCache} from '@libs/Sound';
import {endSpan, getSpan, startSpan} from '@libs/telemetry/activeSpans';
import {cancelAllSpans, endSpan, getSpan, startSpan} from '@libs/telemetry/activeSpans';
import CONST from '@src/CONST';
import type {OnyxKey} from '@src/ONYXKEYS';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -238,6 +238,7 @@ AppState.addEventListener('change', (nextAppState) => {
if (nextAppState.match(/inactive|background/) && appState === 'active') {
Log.info('Flushing logs as app is going inactive', true, {}, true);
saveCurrentPathBeforeBackground();
cancelAllSpans();
}
appState = nextAppState;
});
Expand Down
8 changes: 7 additions & 1 deletion src/libs/telemetry/activeSpans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ function cancelSpan(spanId: string) {
endSpan(spanId);
}

function cancelAllSpans() {
for (const [spanId] of activeSpans.entries()) {
cancelSpan(spanId);
}
}

function getSpan(spanId: string) {
return activeSpans.get(spanId);
}

export {startSpan, endSpan, getSpan, cancelSpan};
export {startSpan, endSpan, getSpan, cancelSpan, cancelAllSpans};
Loading