mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
fix(db-manager): retry a failed relations read on re-entry
A failed read was cached like a successful one, so a transient worker or connection failure left the diagram without relations until the schema was reloaded or the manager remounted. The cache now only answers for a read that succeeded, and leaving the diagram and coming back retries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MXECAKye6KgN13wznsuRzP
This commit is contained in:
co-authored by
Claude Opus 5
parent
decf3150f9
commit
15a225ea4c
@@ -684,8 +684,10 @@
|
||||
[() => viewMode, () => databaseKey, () => colDefs],
|
||||
async ([mode, key, defs], _prev, { data, signal }) => {
|
||||
// Re-read only when the database itself was reloaded: toggling back to
|
||||
// the diagram must not queue the query again.
|
||||
if (mode !== 'diagram' || (data?.databaseKey === key && data?.defs === defs)) return data
|
||||
// the diagram must not queue the query again. A read that failed is not
|
||||
// an answer about this database, so leaving and coming back retries it.
|
||||
const answered = data?.databaseKey === key && data?.defs === defs && !data.failed
|
||||
if (mode !== 'diagram' || answered) return data
|
||||
relationsError = undefined
|
||||
let read: DbRelation[] = []
|
||||
let error: string | undefined
|
||||
@@ -700,7 +702,7 @@
|
||||
// database's tables with this one's relations.
|
||||
if (signal.aborted) throw new DOMException('Superseded', 'AbortError')
|
||||
relationsError = error
|
||||
return { databaseKey: key, defs, relations: read }
|
||||
return { databaseKey: key, defs, relations: read, failed: error !== undefined }
|
||||
}
|
||||
)
|
||||
// Relations are shown only alongside the database they were read from, so a
|
||||
|
||||
Reference in New Issue
Block a user