我目前正在更深入地研究队列并找到了公牛包。所以我安装了它并尝试用他们的文档做一些基本的队列工作。
但是,我根本没有得到任何输出......事件根本没有被触发,我也没有从处理队列中获得日志。我做错了什么?我也已经查看了文档并检查了他们在教程中提供的所有内容。还是没有输出。
(() => {
const steamapi = require('steamapi');
const steam = new steamapi('api_token');
const Queue = require('bull');
const reportQueue = new Queue('Resolving Profiles');
//Adding new profile to queue
reportQueue.add({ profile: '_g9' });
//Processing the queue
reportQueue.process( (job, done) => {
console.log(`Job: ${job.data}`);
steam.resolve(job.data.profile).then(id => {
console.log(id);
});
done();
});
//On finish event
reportQueue.on('completed', (job, result) => {
console.log(`Job: ${job}`);
console.log(`Result: ${result}`);
});
//Progress
reportQueue.on('progress', (job, progress) => {
console.log(`Job progress with result ${job} ${progress}`);
});
})();