Skip to content

Commit 489021a

Browse files
committed
Overlay: use restoreCache() timeout
This commit changes overlay-base database download to use the segmentTimeoutInMs option provided by restoreCache(), instead of using waitForResultWithTimeLimit(), which does not actually limit the duration of the download operation.
1 parent 12dda79 commit 489021a

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

lib/init-action.js

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/overlay-database-utils.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,16 @@ export async function downloadOverlayBaseDatabaseFromCache(
350350
let databaseDownloadDurationMs = 0;
351351
try {
352352
const databaseDownloadStart = performance.now();
353-
const foundKey = await waitForResultWithTimeLimit(
354-
MAX_CACHE_OPERATION_MS,
355-
actionsCache.restoreCache([dbLocation], cacheRestoreKeyPrefix),
356-
() => {
357-
logger.info("Timed out downloading overlay-base database from cache");
353+
const foundKey = await actionsCache.restoreCache(
354+
[dbLocation],
355+
cacheRestoreKeyPrefix,
356+
undefined,
357+
{
358+
// Azure SDK download (which is the default) uses 128MB segments.
359+
// Setting segmentTimeoutInMs to 3000 translates to segment download
360+
// speed of about 40 MB/s, which should be achievable unless the
361+
// download is unreliable (in which case we do want to abort).
362+
segmentTimeoutInMs: 3000,
358363
},
359364
);
360365
databaseDownloadDurationMs = Math.round(

0 commit comments

Comments
 (0)