Skip to content

Commit 1d3c4f2

Browse files
committed
Extract attachment upload delay to named constant
1 parent dc884de commit 1d3c4f2

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/publish/confluence/confluence.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import {
8787
} from "./confluence-verify.ts";
8888
import {
8989
DELETE_DISABLED,
90+
ATTACHMENT_UPLOAD_DELAY_MS,
9091
DELETE_SLEEP_MILLIS,
9192
DESCENDANT_PAGE_SIZE,
9293
EXIT_ON_ERROR,
@@ -452,7 +453,7 @@ async function publish(
452453

453454
// short backoff between uploads
454455
const t0 = performance.now();
455-
await sleep(800);
456+
await sleep(ATTACHMENT_UPLOAD_DELAY_MS);
456457
trace("[ATTACHMENT] sleptMs", { ms: Math.round(performance.now() - t0) }, LogPrefix.ATTACHMENT);
457458
}
458459
trace(

‎src/publish/confluence/constants.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const V2EDITOR_METADATA = {
1818

1919
export const DELETE_SLEEP_MILLIS = 1000; //TODO replace with polling
2020

21+
// Empirically determined delay to avoid Confluence 500 errors on concurrent attachment updates
22+
export const ATTACHMENT_UPLOAD_DELAY_MS = 800;
23+
2124
export const CAN_SET_PERMISSIONS_DISABLED = "CONFLUENCE_LOCAL_STORAGE_CAN_SET_PERMISSIONS_DISABLED";
2225

2326
export const CAN_SET_PERMISSIONS_ENABLED_CACHED = "CONFLUENCE_LOCAL_STORAGE_CAN_SET_PERMISSIONS_ENABLED_CACHED"

0 commit comments

Comments
 (0)