Skip to content

Commit

Permalink
Fix logging in runWithRetry when aborted (#9761)
Browse files Browse the repository at this point in the history
  • Loading branch information
chensixx authored Apr 7, 2022
1 parent 5019095 commit 6bc6e74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/loader/driver-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@fluidframework/core-interfaces": "^0.42.0",
"@fluidframework/driver-definitions": "^0.45.2000-0",
"@fluidframework/gitresources": "^0.1035.1000",
"@fluidframework/odsp-driver-definitions": "^0.58.3000",
"@fluidframework/protocol-base": "^0.1035.1000",
"@fluidframework/protocol-definitions": "^0.1027.1000",
"@fluidframework/telemetry-utils": "^0.58.3000",
Expand Down Expand Up @@ -103,4 +102,4 @@
"version": "0.58.3000",
"broken": {}
}
}
}
16 changes: 12 additions & 4 deletions packages/loader/driver-utils/src/runWithRetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { ITelemetryLogger } from "@fluidframework/common-definitions";
import { delay, performance } from "@fluidframework/common-utils";
import { OdspErrorType } from "@fluidframework/odsp-driver-definitions";
import { DriverErrorType } from "@fluidframework/driver-definitions";
import { canRetryOnError, getRetryDelayFromError } from "./network";
import { pkgVersion } from "./packageVersion";
import { NonRetryableError } from ".";
Expand Down Expand Up @@ -61,15 +61,22 @@ export async function runWithRetry<T>(
eventName: `${fetchCallName}_cancel`,
retry: numRetries,
duration: performance.now() - startTime,
fetchCallName,
}, err);
throw err;
}

if (progress.cancel?.aborted === true) {
logger.sendTelemetryEvent({
eventName: `${fetchCallName}_runWithRetryAborted`,
retry: numRetries,
duration: performance.now() - startTime,
fetchCallName,
}, err);
throw new NonRetryableError(
"runWithRetryAborted",
OdspErrorType.fetchTimeout,
{ eventName: `runWithRetryAborted_${fetchCallName}`, driverVersion: pkgVersion },
"runWithRetry was Aborted",
DriverErrorType.genericError,
{ driverVersion: pkgVersion, fetchCallName },
);
}

Expand All @@ -89,6 +96,7 @@ export async function runWithRetry<T>(
eventName: `${fetchCallName}_lastError`,
retry: numRetries,
duration: performance.now() - startTime,
fetchCallName,
},
lastError);
}
Expand Down

0 comments on commit 6bc6e74

Please sign in to comment.