每当我推送到同一队列时,我都会创建一个队列并进行处理。我已经在其他文件中用异步定义了回调函数。 我正在导入我的函数并作为回调函数传递。
const queue = new Queue('MyQueue', { redis: REDIS_CONFIG });
queue.process('update_question_likes', 1, updateQuestionLikes);
我的回调函数还有进一步的等待函数,这会导致错误。
堆栈跟踪。
["TypeError: (0 , _subDb.getModels) is not a function\n at Queue._callee$ (/root/me-admin/api/queue/QuestionLikesHandler.js:5:24)\n at tryCatch (/root/me-admin/node_modules/regenerator-runtime/runtime.js:62:40)\n at GeneratorFunctionPrototype.invoke [as _invoke] (/root/me-admin/node_modules/regenerator-runtime/runtime.js:296:22)\n at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/root/me-admin/node_modules/regenerator-runtime/runtime.js:114:21)\n at GeneratorFunctionPrototype.tryCatcher (/root/me-admin/node_modules/bluebird/js/release/util.js:16:23)\n at PromiseSpawn._promiseFulfilled (/root/me-admin/node_modules/bluebird/js/release/generators.js:97:49)\n at Queue.<anonymous> (/root/me-admin/node_modules/bluebird/js/release/generators.js:201:15)\n at Queue.updateQuestionLikes (/root/me-admin/api/queue/QuestionLikesHandler.js:114:17)\n at tryCatcher (/root/me-admin/node_modules/bluebird/js/release/util.js:16:23)\n at /root/me-admin/node_modules/bluebird/js/release/method.js:15:34\n at Queue.processJob (/root/me-admin/node_modules/bull/lib/queue.js:1026:22)\n at tryCatcher (/root/me-admin/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/root/me-admin/node_modules/bluebird/js/release/promise.js:512:31)\n at Promise._settlePromise (/root/me-admin/node_modules/bluebird/js/release/promise.js:569:18)\n at Promise._settlePromise0 (/root/me-admin/node_modules/bluebird/js/release/promise.js:614:10)\n at Promise._settlePromises (/root/me-admin/node_modules/bluebird/js/release/promise.js:693:18)\n at Promise._fulfill (/root/me-admin/node_modules/bluebird/js/release/promise.js:638:18)"]