@naturalcycles/nodejs-lib 12.55.0 → 12.55.1

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.
@@ -54,12 +54,8 @@ function transformMap2(mapper, opt = {}) {
54
54
  // Stop processing if THROW_IMMEDIATELY mode is used
55
55
  if (isRejected && errorMode === js_lib_1.ErrorMode.THROW_IMMEDIATELY)
56
56
  return cb();
57
- let calledBack = false;
58
- // Allow up to 1 x concurrency "buffer" (aka highWatermark)
59
- if (q.queueSize < concurrency) {
60
- cb();
61
- calledBack = true;
62
- }
57
+ // It resolves when it is successfully STARTED execution.
58
+ // If it's queued instead - it'll wait and resolve only upon START.
63
59
  await q.push(async () => {
64
60
  try {
65
61
  const currentIndex = index; // because we need to pass it to 2 functions - mapper and predicate. Refers to INPUT index (since it may return multiple outputs)
@@ -90,9 +86,7 @@ function transformMap2(mapper, opt = {}) {
90
86
  });
91
87
  // Resolved, which means it STARTED processing
92
88
  // This means we can take more load
93
- if (!calledBack) {
94
- cb();
95
- }
89
+ cb();
96
90
  },
97
91
  });
98
92
  function logErrorStats(logger, final = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "12.55.0",
3
+ "version": "12.55.1",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
@@ -82,14 +82,8 @@ export function transformMap2<IN = any, OUT = IN>(
82
82
  // Stop processing if THROW_IMMEDIATELY mode is used
83
83
  if (isRejected && errorMode === ErrorMode.THROW_IMMEDIATELY) return cb()
84
84
 
85
- let calledBack = false
86
-
87
- // Allow up to 1 x concurrency "buffer" (aka highWatermark)
88
- if (q.queueSize < concurrency) {
89
- cb()
90
- calledBack = true
91
- }
92
-
85
+ // It resolves when it is successfully STARTED execution.
86
+ // If it's queued instead - it'll wait and resolve only upon START.
93
87
  await q.push(async () => {
94
88
  try {
95
89
  const currentIndex = index // because we need to pass it to 2 functions - mapper and predicate. Refers to INPUT index (since it may return multiple outputs)
@@ -128,9 +122,7 @@ export function transformMap2<IN = any, OUT = IN>(
128
122
 
129
123
  // Resolved, which means it STARTED processing
130
124
  // This means we can take more load
131
- if (!calledBack) {
132
- cb()
133
- }
125
+ cb()
134
126
  },
135
127
  })
136
128