mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-26 08:01:38 +00:00
feat: add per-folder caching for multi-folder runnables loading
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -223,18 +223,24 @@
|
||||
}
|
||||
})
|
||||
|
||||
async function getCachedRunnables(workspace: string, folder: string): Promise<string[]> {
|
||||
const cacheKey = `${workspace}-false-${folder}`
|
||||
if (runnablesCache.has(cacheKey)) {
|
||||
return runnablesCache.get(cacheKey) || []
|
||||
}
|
||||
const [scripts, flows] = await Promise.all([
|
||||
getScripts(false, workspace, folder),
|
||||
getFlows(false, workspace, folder)
|
||||
])
|
||||
const combined = [...scripts, ...flows]
|
||||
runnablesCache.set(cacheKey, combined)
|
||||
return combined
|
||||
}
|
||||
|
||||
async function loadRunnablesForFolders(workspace: string, folders: string[]) {
|
||||
try {
|
||||
loadingRunnables = true
|
||||
const results = await Promise.all(
|
||||
folders.map(async (folder) => {
|
||||
const [scripts, flows] = await Promise.all([
|
||||
getScripts(false, workspace, folder),
|
||||
getFlows(false, workspace, folder)
|
||||
])
|
||||
return [...scripts, ...flows]
|
||||
})
|
||||
)
|
||||
const results = await Promise.all(folders.map((f) => getCachedRunnables(workspace, f)))
|
||||
includedRunnables = [...new Set(results.flat())]
|
||||
} finally {
|
||||
loadingRunnables = false
|
||||
|
||||
Reference in New Issue
Block a user