smoltalk 0.0.49 → 0.0.50
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/dist/statelogClient.d.ts
CHANGED
package/dist/statelogClient.js
CHANGED
|
@@ -5,13 +5,9 @@ export class BaseStrategy {
|
|
|
5
5
|
this.statelogClient = config.statelog
|
|
6
6
|
? getStatelogClient(config.statelog)
|
|
7
7
|
: undefined;
|
|
8
|
-
this.statelogClient?.debug(
|
|
9
|
-
strategy: this.toString(),
|
|
10
|
-
});
|
|
8
|
+
this.statelogClient?.debug(`Starting strategy ${this.toString()}`);
|
|
11
9
|
if (config.hooks?.onStrategyStart) {
|
|
12
|
-
this.statelogClient?.debug(
|
|
13
|
-
strategy: this.toString(),
|
|
14
|
-
});
|
|
10
|
+
this.statelogClient?.debug(`Calling onStrategyStart hook for strategy ${this.toString()}`);
|
|
15
11
|
config.hooks.onStrategyStart(this, config);
|
|
16
12
|
}
|
|
17
13
|
return this._text({ ...config, strategy: undefined });
|
|
@@ -20,9 +16,7 @@ export class BaseStrategy {
|
|
|
20
16
|
this.statelogClient = config.statelog
|
|
21
17
|
? getStatelogClient(config.statelog)
|
|
22
18
|
: undefined;
|
|
23
|
-
this.statelogClient?.debug(
|
|
24
|
-
strategy: this.toString(),
|
|
25
|
-
});
|
|
19
|
+
this.statelogClient?.debug(`Starting strategy (sync) ${this.toString()}`);
|
|
26
20
|
return this._textSync({ ...config, strategy: undefined });
|
|
27
21
|
}
|
|
28
22
|
async textStream(config) {
|
|
@@ -27,7 +27,14 @@ export class RaceStrategy extends BaseStrategy {
|
|
|
27
27
|
abortSignal: controllers[i].signal,
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
+
let winnerIndex = null;
|
|
30
31
|
return Promise.race(promises.map((p, i) => p.then((result) => {
|
|
32
|
+
if (winnerIndex !== null) {
|
|
33
|
+
// This strategy resolved after the winner (e.g. due to being aborted).
|
|
34
|
+
// Do not attempt to abort other strategies again.
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
winnerIndex = i;
|
|
31
38
|
for (let j = 0; j < controllers.length; j++) {
|
|
32
39
|
if (j !== i) {
|
|
33
40
|
const logger = getLogger();
|