@icgio/icg-utils 1.9.75 → 1.9.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install @icgio/icg-utils
13
13
  | `crypto_rates(cb, curs, type)` | `'curs'`: Coinpaprika USD prices for a list of symbols. `'curs_dict'`: mid of `<cur>/USDT` on the exchange named per currency, e.g. `{ B3TR: 'mexc' }`. Calls back with `{ CUR: { USD, USDT } }`, leaving out currencies it could not price. |
14
14
  | `forex_rate.get_forex_rate_usd(curs, cb)` | USD value of one unit of each fiat currency. |
15
15
  | `influx` | `new Influx({ url, token, org, org_id, bucket, schema, transportOptions })` with `query(flux, cb)` and `write_points_with_check(points, cb)`. Writes drop points or fields that `schema` does not know and values that are missing or not finite, and create the bucket on first use. |
16
- | `rate_limiter` | `new RateLimiter({ max_concurrent, interval_concurrent, abandon_tx, only_same_args })`, then `limiter.process(fn, ...args)`. Setting `limiter.priority` before `process` queues that call ahead of higher numbers. |
16
+ | `rate_limiter` | `new RateLimiter({ max_concurrent, interval_concurrent, abandon_tx, only_same_args })`, then `limiter.process(fn, ...args)`. Setting `limiter.priority` before `process` queues that call ahead of higher numbers; priority 0 runs at once even when the window is spent, up to one extra window's worth (beyond that it queues ahead of everything else), and still counts in it. |
17
17
  | `sorted_book`, `utils.ordered_dict` | Price-level books keyed by price: a red-black tree for large books, a binary-searched array for small ones. |
18
18
  | `market_history_buffer` | Record, prune and read the per-pair trade buffers in `market.market_history_dict`. |
19
19
  | `observable` | Minimal `subscribe` / `notify` class. |
@@ -38,7 +38,8 @@ class RateLimiter {
38
38
  }, this.interval_concurrent)
39
39
  }
40
40
  } else {
41
- if (this.count < this.max_concurrent) {
41
+ // priority 0 does not wait for the window, up to one extra window's worth: it runs now and still counts in it; beyond that it queues first
42
+ if (this.count < this.max_concurrent || (priority === 0 && this.count < 2 * this.max_concurrent)) {
42
43
  this.count++
43
44
  this._scheduleResetTimer()
44
45
  func(...args)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.75",
3
+ "version": "1.9.77",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {