Bugfix/Circular Dependency of updateStorageUsage and checkStorage in utils (#4717)

fix circular dependency of updateStorageUsage and checkStorage in utils
This commit is contained in:
Henry Heng 2025-06-24 17:24:45 +01:00 committed by GitHub
parent 4038eb13fc
commit 397ba63d60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 7 deletions

View File

@ -28,6 +28,9 @@
"start:default": "cd bin && ./run start",
"start-worker:windows": "cd bin && run worker",
"start-worker:default": "cd bin && ./run worker",
"user": "run-script-os",
"user:windows": "cd bin && run user",
"user:default": "cd bin && ./run user",
"dev": "nodemon",
"oclif-dev": "run-script-os",
"oclif-dev:windows": "cd bin && dev start",

View File

@ -10,6 +10,7 @@ import {
getStartingNodes,
resolveVariables
} from '../../utils'
import { checkStorage, updateStorageUsage } from '../../utils/quotaUsage'
import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
import { ChatFlow } from '../../database/entities/ChatFlow'
import { IDepthQueue, IReactFlowNode } from '../../Interface'
@ -110,7 +111,9 @@ const buildAndInitTool = async (chatflowid: string, _chatId?: string, _apiMessag
variableOverrides,
orgId,
workspaceId,
subscriptionId
subscriptionId,
updateStorageUsage,
checkStorage
})
const nodeToExecute =

View File

@ -515,7 +515,9 @@ export const executeFlow = async ({
baseURL,
orgId,
workspaceId,
subscriptionId
subscriptionId,
updateStorageUsage,
checkStorage
})
const setVariableNodesOutput = getSetVariableNodesOutput(reactFlowNodes)

View File

@ -64,8 +64,6 @@ import {
SecretsManagerClient,
SecretsManagerClientConfig
} from '@aws-sdk/client-secrets-manager'
import { checkStorage, updateStorageUsage } from './quotaUsage'
import { UsageCacheManager } from '../UsageCacheManager'
export const QUESTION_VAR_PREFIX = 'question'
export const FILE_ATTACHMENT_PREFIX = 'file_attachment'
@ -504,8 +502,10 @@ type BuildFlowParams = {
orgId?: string
workspaceId?: string
subscriptionId?: string
usageCacheManager?: UsageCacheManager
usageCacheManager?: any
uploadedFilesContent?: string
updateStorageUsage?: (orgId: string, workspaceId: string, totalSize: number, usageCacheManager?: any) => void
checkStorage?: (orgId: string, subscriptionId: string, usageCacheManager: any) => Promise<any>
}
/**
@ -540,7 +540,9 @@ export const buildFlow = async ({
orgId,
workspaceId,
subscriptionId,
usageCacheManager
usageCacheManager,
updateStorageUsage,
checkStorage
}: BuildFlowParams) => {
const flowNodes = cloneDeep(reactFlowNodes)

View File

@ -193,7 +193,9 @@ export const executeUpsert = async ({
variableOverrides,
orgId,
workspaceId,
subscriptionId
subscriptionId,
updateStorageUsage,
checkStorage
})
// Save to DB