Skip to content

Commit faba439

Browse files
[perf] disable cache-busting param on cloud (#6105)
## Summary Updates `ComfyApp.getRandParam()` to return an empty string on cloud builds (detected via `isCloud`), letting hosted deployments rely on HTTP caching for `/view` assets while local hosts retain the legacy cache busting. The audio widget helpers now defer to the same method instead of generating their own random suffix, so every frontend consumer shares this logic. This keeps the original overwrite protection for localhost workflows but removes needless cache misses in the cloud stack, where GCS already serve strong ETags and there is not really a concern about stale filenames. Once the backend exposes a deterministic file-version field, we can delete the remaining local-only randomness entirely. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6105-perf-disable-cache-busting-param-on-cloud-28f6d73d36508181b34afad406fabc59) by [Unito](https://www.unito.io)
1 parent 32e6cfa commit faba439

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/renderer/extensions/vueNodes/widgets/utils/audioUtils.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ResultItemType } from '@/schemas/apiSchema'
22
import { api } from '@/scripts/api'
3+
import { app } from '@/scripts/app'
34

45
/**
56
* Format time in MM:SS format
@@ -23,10 +24,6 @@ export function getAudioUrlFromPath(
2324
return api.apiURL(getResourceURL(subfolder, filename, type))
2425
}
2526

26-
function getRandParam() {
27-
return '&rand=' + Math.random()
28-
}
29-
3027
export function getResourceURL(
3128
subfolder: string,
3229
filename: string,
@@ -36,7 +33,7 @@ export function getResourceURL(
3633
'filename=' + encodeURIComponent(filename),
3734
'type=' + type,
3835
'subfolder=' + subfolder,
39-
getRandParam().substring(1)
36+
app.getRandParam().substring(1)
4037
].join('&')
4138

4239
return `/view?${params}`

src/scripts/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from '@/lib/litegraph/src/litegraph'
1717
import type { Vector2 } from '@/lib/litegraph/src/litegraph'
1818
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
19+
import { isCloud } from '@/platform/distribution/types'
1920
import { useSettingStore } from '@/platform/settings/settingStore'
2021
import { useToastStore } from '@/platform/updates/common/toastStore'
2122
import { useWorkflowService } from '@/platform/workflow/core/services/workflowService'
@@ -336,6 +337,7 @@ export class ComfyApp {
336337
}
337338

338339
getRandParam() {
340+
if (isCloud) return ''
339341
return '&rand=' + Math.random()
340342
}
341343

0 commit comments

Comments
 (0)