Commit 91510e93 by 王悦

fix判断队列是否存在消息,存在则不重复提交

parent 8e374d7d
......@@ -816,11 +816,14 @@ class TrademarktransactionService extends ServiceBase {
return err
}
async allOnSale(pobj, status) {
let res = await this.dao.model.findAll({where: {publish_status:"audit"}})
while (res.length>0){
let push_data = res.splice(0,100)
let ids = push_data.map(ite=>ite.id)
Channel.sendToQueue(queName, Buffer.from(JSON.stringify(ids)), {persistent: true});
let ok = await Channel.assertQueue(queName, {durable: true})
if (ok.messageCount === 0) {
let res = await this.dao.model.findAll({where: {publish_status: "audit"}})
while (res.length > 0) {
let push_data = res.splice(0, 100)
let ids = push_data.map(ite => ite.id)
Channel.sendToQueue(queName, Buffer.from(JSON.stringify(ids)), {persistent: true});
}
}
return system.getResultSuccess()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment