Skip to content

Commit 9c31f4d

Browse files
committed
remove "PQueue" for strategy handling; use just plain intervals
1 parent 17e5ec8 commit 9c31f4d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/modules/listener/tick_listener.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const moment = require('moment');
22
const _ = require('lodash');
3-
const { default: PQueue } = require('p-queue');
43
const StrategyContext = require('../../dict/strategy_context');
54

65
module.exports = class TickListener {
@@ -161,8 +160,6 @@ module.exports = class TickListener {
161160
async startStrategyIntervals() {
162161
this.logger.info(`Starting strategy intervals`);
163162

164-
const queue = new PQueue({ concurrency: this.systemUtil.getConfig('tick.pair_signal_concurrency', 10) });
165-
166163
const me = this;
167164

168165
const types = [
@@ -230,11 +227,13 @@ module.exports = class TickListener {
230227
);
231228

232229
// first run call
233-
queue.add(strategyIntervalCallback);
230+
setTimeout(async () => {
231+
await strategyIntervalCallback();
232+
}, 1000 + Math.floor(Math.random() * (800 - 300 + 1)) + 100);
234233

235234
// continuous run
236-
setInterval(() => {
237-
queue.add(strategyIntervalCallback);
235+
setInterval(async () => {
236+
await strategyIntervalCallback();
238237
}, interval);
239238
}, timeoutWindow);
240239
});

0 commit comments

Comments
 (0)