|
@ -71,7 +71,7 @@ class SiteWorker extends SiteCommon { |
|
|
const { COMPONENT } = ProcessorClass; |
|
|
const { COMPONENT } = ProcessorClass; |
|
|
|
|
|
|
|
|
this.log.info('loading worker processor', { component: COMPONENT.logId }); |
|
|
this.log.info('loading worker processor', { component: COMPONENT.logId }); |
|
|
this.processors[COMPONENT.name] = processor; |
|
|
this.processors[COMPONENT.index] = processor; |
|
|
|
|
|
|
|
|
return processor; |
|
|
return processor; |
|
|
} |
|
|
} |
|
@ -83,20 +83,20 @@ class SiteWorker extends SiteCommon { |
|
|
*/ |
|
|
*/ |
|
|
async startProcessors ( ) { |
|
|
async startProcessors ( ) { |
|
|
const slugs = Object.keys(this.processors); |
|
|
const slugs = Object.keys(this.processors); |
|
|
await SiteAsync.each(slugs, async (slug) => { |
|
|
for (const slug of slugs) { |
|
|
const processor = this.processors[slug]; |
|
|
const processor = this.processors[slug]; |
|
|
try { |
|
|
try { |
|
|
this.log.info('starting worker processor', { |
|
|
this.log.info('starting worker processor', { |
|
|
component: processor.component.name, |
|
|
component: processor.component.logId, |
|
|
}); |
|
|
}); |
|
|
await processor.start(); |
|
|
await processor.start(); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
this.log.error('failed to start processor', { |
|
|
this.log.error('failed to start processor', { |
|
|
component: processor.component.name, |
|
|
component: processor.component.logId, |
|
|
error, |
|
|
error, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}, 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -108,12 +108,12 @@ class SiteWorker extends SiteCommon { |
|
|
const processor = this.processors[slug]; |
|
|
const processor = this.processors[slug]; |
|
|
try { |
|
|
try { |
|
|
this.log.info('stopping worker processor', { |
|
|
this.log.info('stopping worker processor', { |
|
|
component: processor.component.name, |
|
|
component: processor.component.logId, |
|
|
}); |
|
|
}); |
|
|
await processor.stop(); |
|
|
await processor.stop(); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
this.log.error('failed to stop processor', { |
|
|
this.log.error('failed to stop processor', { |
|
|
component: processor.component.name, |
|
|
component: processor.component.logId, |
|
|
error, |
|
|
error, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|