Closed nanhupatar closed 2 years ago
job文件
class BaseQueue extends Job { static get queue() { return 'accessTokenSchedule'; // 使用的队列名称 } async run(info) { try { const queue = await this.app.bus.get('accessTokenSchedule'); console.log('queue->>', queue); } catch (error) { console.log(error); } } }
触发
app.bus.dispatch( 'accessTokenSchedule', {} // { // repeat: { // every: 10000, // limit: 10, // }, // } );
queue为undefined
破案了 需要这样使用 this.app.bus.get('bus:accessTokenSchedule') 一个隐形的小问题
这是一个 bug。如果直接改,可能是个 break change。暂时也没有发布大版本的计划,先这样吧。
job文件
触发
queue为undefined