我正在开发一个大量使用bull的NestJs服务。有一段时间,一切都很好。但最近,我在所有托管环境中都遇到了一个问题——没有工作能接触到消费者。我用公牛监测器监测流量。每个队列中的每个作业都会进入活动状态,挂起约30秒,并因消息作业暂停超过允许的限制而失败。
作业在沙盒进程中处理。
const queues = [
BullModule.registerQueueAsync({
name: PROCESS_NEW_EVENT,
useFactory: async () => ({
defaultJobOptions: JOBS_CONFIG,
processors: [
{
path: join(__dirname, 'jobs/handle-new-event.processor.js'),
concurrency: DEFAULT_CONCURRENCY,
},
],
}),
}),
];
@Module({
imports: [
AnotherModule,
...queues,
],
providers: [Repository, Service],
controllers: [Controller],
exports: `[Repository,` ...queues],
})
export class EventModule {}
如果jobs/handle-new-event.prrocessor.js包含以下代码
export default async function processNewEvent(job) {
console.log('got job');
await executor(job);
console.log('job processed');
}
然后得到的作业永远不会打印。
我想这可能是Redis服务器的问题。但当我从本地环境连接到同一台服务器时,一切都很好。
我将感谢任何建议和指示。