mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 14:54:12 +00:00
logging: log context on session storage write error (QuotaError) (#6636)
adds some context to the storage write errors observed in telemetry data - in order to pinpoint the exact cause. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6636-logging-log-context-on-session-storage-write-error-QuotaError-2a56d73d365081c28bb0dbfdfef8395a) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -20,9 +20,28 @@ export function useWorkflowPersistence() {
|
||||
const persistCurrentWorkflow = () => {
|
||||
if (!workflowPersistenceEnabled.value) return
|
||||
const workflow = JSON.stringify(comfyApp.graph.serialize())
|
||||
localStorage.setItem('workflow', workflow)
|
||||
if (api.clientId) {
|
||||
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
|
||||
|
||||
try {
|
||||
localStorage.setItem('workflow', workflow)
|
||||
if (api.clientId) {
|
||||
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
|
||||
}
|
||||
} catch (error) {
|
||||
// Only log our own keys and aggregate stats
|
||||
const ourKeys = Object.keys(sessionStorage).filter(
|
||||
(key) => key.startsWith('workflow:') || key === 'workflow'
|
||||
)
|
||||
console.error('QuotaExceededError details:', {
|
||||
workflowSizeKB: Math.round(workflow.length / 1024),
|
||||
totalStorageItems: Object.keys(sessionStorage).length,
|
||||
ourWorkflowKeys: ourKeys.length,
|
||||
ourWorkflowSizes: ourKeys.map((key) => ({
|
||||
key,
|
||||
sizeKB: Math.round(sessionStorage[key].length / 1024)
|
||||
})),
|
||||
error: error instanceof Error ? error.message : String(error)
|
||||
})
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user