MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / processQueue

Function processQueue

src/stores/session.ts:242–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

240 const MIN_STAGE_TIME = 1000
241
242 const processQueue = async () => {
243 if (isProcessing) return
244 isProcessing = true
245
246 while (queue.length > 0) {
247 const next = queue[0]
248
249 if (next.stage !== currentStage) {
250 const elapsed = Date.now() - lastStageTime
251 if (elapsed < MIN_STAGE_TIME) {
252 await new Promise((resolve) => setTimeout(resolve, MIN_STAGE_TIME - elapsed))
253 }
254 currentStage = next.stage
255 lastStageTime = Date.now()
256 }
257
258 importProgress.value = queue.shift()!
259 }
260 isProcessing = false
261 }
262
263 const importResult = await useImportService().importFile(filePath, undefined, (progress) => {
264 if (progress.stage === 'done') return

Callers 2

importFileFromPathFunction · 0.85
importFilesFromPathsFunction · 0.85

Calls 2

setTimeoutFunction · 0.85
nowMethod · 0.45

Tested by

no test coverage detected