Version scan terminal cache key
This commit is contained in:
@@ -56,6 +56,16 @@ export function runTests() {
|
|||||||
/hasDirectBackendApiBaseUrl/,
|
/hasDirectBackendApiBaseUrl/,
|
||||||
"public scan terminal requests should only attach user auth in direct-backend mode so CDN caches can be shared through the Next proxy",
|
"public scan terminal requests should only attach user auth in direct-backend mode so CDN caches can be shared through the Next proxy",
|
||||||
);
|
);
|
||||||
|
assert.match(
|
||||||
|
scanTerminalClientSource,
|
||||||
|
/SCAN_TERMINAL_PAYLOAD_VERSION/,
|
||||||
|
"scan terminal client should include a stable payload version in the URL so CDN caches roll forward after response-shape optimizations",
|
||||||
|
);
|
||||||
|
assert.match(
|
||||||
|
scanTerminalClientSource,
|
||||||
|
/params\.set\("_v",\s*SCAN_TERMINAL_PAYLOAD_VERSION\)/,
|
||||||
|
"scan terminal client should vary the CDN cache key without changing backend scan filters",
|
||||||
|
);
|
||||||
|
|
||||||
const overviewProxySource = fs.readFileSync(
|
const overviewProxySource = fs.readFileSync(
|
||||||
path.join(
|
path.join(
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const scanTerminalQueryPolicy = {
|
|||||||
autoRefreshMs: null,
|
autoRefreshMs: null,
|
||||||
manualForceRefreshCooldownMs: 2 * 60_000,
|
manualForceRefreshCooldownMs: 2 * 60_000,
|
||||||
} as const;
|
} as const;
|
||||||
|
const SCAN_TERMINAL_PAYLOAD_VERSION = "runway-slim-v1";
|
||||||
|
|
||||||
type TerminalQueryOptions = {
|
type TerminalQueryOptions = {
|
||||||
forceRefresh?: boolean;
|
forceRefresh?: boolean;
|
||||||
@@ -142,6 +143,7 @@ async function getTerminal({
|
|||||||
if (Number.isFinite(timezoneOffsetSeconds)) {
|
if (Number.isFinite(timezoneOffsetSeconds)) {
|
||||||
params.set("timezone_offset_seconds", String(Math.trunc(Number(timezoneOffsetSeconds))));
|
params.set("timezone_offset_seconds", String(Math.trunc(Number(timezoneOffsetSeconds))));
|
||||||
}
|
}
|
||||||
|
params.set("_v", SCAN_TERMINAL_PAYLOAD_VERSION);
|
||||||
if (forceRefresh) {
|
if (forceRefresh) {
|
||||||
params.set("_ts", String(Date.now()));
|
params.set("_ts", String(Date.now()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user