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

Method run

packages/server/src/commands/worker.ts:22–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 scheduleWorkerId: string
21
22 async run(): Promise<void> {
23 logger.info('Starting Flowise Worker...')
24
25 const { appDataSource, telemetry, componentNodes, cachePool, abortControllerPool, usageCacheManager, identityManager } =
26 await this.prepareData()
27
28 const queueManager = QueueManager.getInstance()
29 queueManager.setupAllQueues({
30 componentNodes,
31 telemetry,
32 cachePool,
33 appDataSource,
34 abortControllerPool,
35 usageCacheManager,
36 identityManager
37 })
38
39 /** Prediction */
40 const predictionQueue = queueManager.getQueue('prediction')
41 const predictionWorker = predictionQueue.createWorker()
42 this.predictionWorkerId = predictionWorker.id
43 logger.info(`Prediction Worker ${this.predictionWorkerId} created`)
44
45 const predictionQueueName = predictionQueue.getQueueName()
46 const queueEvents = new QueueEvents(predictionQueueName, { connection: queueManager.getConnection() })
47
48 queueEvents.on<CustomListener>('abort', async ({ id }: { id: string }) => {
49 abortControllerPool.abort(id)
50 })
51
52 /** Upsertion */
53 const upsertionQueue = queueManager.getQueue('upsert')
54 const upsertionWorker = upsertionQueue.createWorker()
55 this.upsertionWorkerId = upsertionWorker.id
56 logger.info(`Upsertion Worker ${this.upsertionWorkerId} created`)
57
58 /** Schedule */
59 const scheduleQueue = queueManager.getQueue('schedule')
60 const scheduleWorker = scheduleQueue.createWorker()
61 this.scheduleWorkerId = scheduleWorker.id
62 logger.info(`Schedule Worker ${this.scheduleWorkerId} created`)
63
64 // Keep the process running
65 process.stdin.resume()
66 }
67
68 async prepareData() {
69 // Init database

Callers

nothing calls this directly

Calls 7

prepareDataMethod · 0.95
setupAllQueuesMethod · 0.80
abortMethod · 0.80
getInstanceMethod · 0.45
getQueueMethod · 0.45
getQueueNameMethod · 0.45
getConnectionMethod · 0.45

Tested by

no test coverage detected