Commit 91510e93 by 王悦

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

parent 8e374d7d
...@@ -816,11 +816,14 @@ class TrademarktransactionService extends ServiceBase { ...@@ -816,11 +816,14 @@ class TrademarktransactionService extends ServiceBase {
return err return err
} }
async allOnSale(pobj, status) { async allOnSale(pobj, status) {
let res = await this.dao.model.findAll({where: {publish_status:"audit"}}) let ok = await Channel.assertQueue(queName, {durable: true})
while (res.length>0){ if (ok.messageCount === 0) {
let push_data = res.splice(0,100) let res = await this.dao.model.findAll({where: {publish_status: "audit"}})
let ids = push_data.map(ite=>ite.id) while (res.length > 0) {
Channel.sendToQueue(queName, Buffer.from(JSON.stringify(ids)), {persistent: true}); 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() 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