Questions tagged «bull.js»

2
我如何确保某项工作在Bull中不会执行两次?
我有两个功能,scheduleScan()和scan()。 scan()scheduleScan() 在除了安排新扫描之外无其他操作时调用,因此scheduleScan()可以安排scan()。但是有一个问题,有些作业要运行两次。 我想确保在任何给定时间仅处理一项作业。我该如何实现?我相信与done()(,它已经在scan()中,现在已删除)有关,但我无法提出解决方案。 公牛版:3.12.1 重要的后期编辑: scan()调用另一个函数,它们可能会调用也可能不会调用其他函数,但是它们都是同步函数,因此它们仅在完成自己的作业时才调用一个函数,只有一种前进的方式。我在“树”的末尾调用它,最后一个函数调用scheduleScan(),但是不能同时运行两个作业。scan()顺便说一句,每个工作都始于,然后以scheduleScan(stock, period, milliseconds, 'called by file.js') export function update(job) { // does some calculations, then it may call scheduleScan() or // it may call another function, and that could be the one calling // scheduleScan() function. // For instance, a function like finalize() } …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.