MCPcopy
hub / github.com/FlowiseAI/Flowise / checkStorage

Function checkStorage

packages/server/src/utils/quotaUsage.ts:153–171  ·  view source on GitHub ↗
(orgId: string, subscriptionId: string, usageCacheManager: UsageCacheManager)

Source from the content-addressed store, hash-verified

151}
152
153export const checkStorage = async (orgId: string, subscriptionId: string, usageCacheManager: UsageCacheManager) => {
154 if (!usageCacheManager || !subscriptionId) return
155
156 let currentStorageUsage = 0
157 currentStorageUsage = (await usageCacheManager.get(`storage:${orgId}`)) || 0
158
159 const quotas = await usageCacheManager.getQuotas(subscriptionId)
160 const storageLimit = quotas[LICENSE_QUOTAS.STORAGE_LIMIT]
161 if (storageLimit === -1) return
162
163 if (currentStorageUsage >= storageLimit) {
164 throw new InternalFlowiseError(StatusCodes.PAYMENT_REQUIRED, 'Storage limit exceeded')
165 }
166
167 return {
168 usage: currentStorageUsage,
169 limit: storageLimit
170 }
171}

Callers 7

executeUpsertFunction · 0.90
createFileAttachmentFunction · 0.90
executeFlowFunction · 0.90
_saveFileToStorageFunction · 0.90
upsertDocStoreFunction · 0.90
runMethod · 0.85

Calls 2

getQuotasMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected