Disallow floating promises. (#14605)

This commit is contained in:
Christian Gunderman
2025-12-05 16:12:49 -08:00
committed by GitHub
parent 3cf44acc08
commit 025e450ac2
57 changed files with 128 additions and 4 deletions
@@ -284,6 +284,7 @@ export class ClearcutLogger {
event: LogEvent,
): Promise<void> {
try {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.config?.getExperimentsAsync().then((experiments) => {
if (experiments) {
const exp_id_data: EventValue[] = [
@@ -557,6 +558,7 @@ export class ClearcutLogger {
this.sessionData = data;
// Flush after experiments finish loading from CCPA server
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.enqueueLogEventAfterExperimentsLoadAsync(
this.createLogEvent(EventNames.START_SESSION, data),
).then(() => {
@@ -900,6 +902,7 @@ export class ClearcutLogger {
];
// Flush after experiments finish loading from CCPA server
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.enqueueLogEventAfterExperimentsLoadAsync(
this.createLogEvent(EventNames.START_SESSION, data),
).then(() => {
@@ -96,6 +96,7 @@ export class GcpLogExporter implements LogRecordExporter {
.finally(() => {
const index = this.pendingWrites.indexOf(writePromise);
if (index > -1) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.pendingWrites.splice(index, 1);
}
});
+3
View File
@@ -94,6 +94,7 @@ export function isTelemetrySdkInitialized(): boolean {
export function bufferTelemetryEvent(fn: () => void | Promise<void>): void {
if (telemetryInitialized) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
fn();
} else {
telemetryBuffer.push(fn);
@@ -303,9 +304,11 @@ export async function initializeTelemetry(
// and won't wait for the async shutdownTelemetry() to complete.
// Instead, telemetry shutdown is handled in runExitCleanup() in cleanup.ts
process.on('SIGTERM', () => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
shutdownTelemetry(config);
});
process.on('SIGINT', () => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
shutdownTelemetry(config);
});
}