Skip to content

Commit e53da9d

Browse files
committed
fix maplimit
1 parent 411e145 commit e53da9d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/node-binance-api.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5803,10 +5803,11 @@ export default class Binance {
58035803
}
58045804
};
58055805

5806-
const getSymbolDepthSnapshot = async (symbol: string, cb: Function) => {
5806+
const getSymbolDepthSnapshot = async (symbol: string) => {
58075807
const json = await this.publicSpotRequest('v3/depth', { symbol: symbol, limit: limit });
58085808
json.symbol = symbol;
5809-
cb(null, json);
5809+
// cb(null, json);
5810+
return json;
58105811
};
58115812

58125813
const updateSymbolDepthCache = json => {
@@ -5842,12 +5843,13 @@ export default class Binance {
58425843
const streams = symbols.map(function (symbol) {
58435844
return symbol.toLowerCase() + `@depth@100ms`;
58445845
});
5846+
const mapLimit = this.mapLimit.bind(this);
58455847
subscription = this.subscribeCombined(streams, handleDepthStreamData, reconnect, function () {
58465848
// async.mapLimit(symbols, 50, getSymbolDepthSnapshot, (err, results) => {
58475849
// if (err) throw err;
58485850
// results.forEach(updateSymbolDepthCache);
58495851
// });
5850-
this.mapLimit(symbols, 50, getSymbolDepthSnapshot)
5852+
mapLimit(symbols, 50, getSymbolDepthSnapshot)
58515853
.then(results => {
58525854
results.forEach(updateSymbolDepthCache);
58535855
})
@@ -5859,12 +5861,13 @@ export default class Binance {
58595861
} else {
58605862
const symbol = symbols;
58615863
symbolDepthInit(symbol);
5864+
const mapLimit = this.mapLimit.bind(this);
58625865
subscription = this.subscribe(symbol.toLowerCase() + `@depth@100ms`, handleDepthStreamData, reconnect, function () {
58635866
// async.mapLimit([symbol], 1, getSymbolDepthSnapshot, (err, results) => {
58645867
// if (err) throw err;
58655868
// results.forEach(updateSymbolDepthCache);
58665869
// });
5867-
this.mapLimit([symbol], 1, getSymbolDepthSnapshot)
5870+
mapLimit([symbol], 1, getSymbolDepthSnapshot)
58685871
.then(results => {
58695872
results.forEach(updateSymbolDepthCache);
58705873
})

0 commit comments

Comments
 (0)