@systemfsoftware/effect-daemon-spec 3.0.14 → 4.1.0
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/CHANGELOG.md +12 -0
- package/dist/effect-daemon-spec-untrimmed.d.ts +8 -2
- package/dist/effect-daemon-spec.d.ts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.mjs +63 -41
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @systemfsoftware/effect-daemon-spec
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `cappedBackoff`, `worker`, `leader`, `task`, `withLeaderLock` and the other exported functions that took their subject first can now also be called data-last inside `pipe`. Existing calls keep working.
|
|
8
|
+
|
|
9
|
+
## 4.0.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- A supervisor whose restart decision cannot read its own restart command now logs the error and cools down, the same as when its restart budget runs out. It used to die and take its children down with it.
|
|
14
|
+
|
|
3
15
|
## 3.0.14
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -22,7 +22,10 @@ declare const BoundedIntensity_base: Schema.Class<BoundedIntensity, Schema.Tagge
|
|
|
22
22
|
readonly window: Schema.Duration;
|
|
23
23
|
}>, {}>;
|
|
24
24
|
|
|
25
|
-
export declare const cappedBackoff:
|
|
25
|
+
export declare const cappedBackoff: {
|
|
26
|
+
(cap: Duration.Input): (base: Duration.Input) => Schedule.Schedule<Duration.Duration>;
|
|
27
|
+
(base: Duration.Input, cap: Duration.Input): Schedule.Schedule<Duration.Duration>;
|
|
28
|
+
};
|
|
26
29
|
|
|
27
30
|
export declare type Child<E, R> = Worker_2<E, R> | Supervisor<E, R>;
|
|
28
31
|
|
|
@@ -371,7 +374,10 @@ declare const UnboundedIntensity_base: Schema.Class<UnboundedIntensity, Schema.T
|
|
|
371
374
|
/**
|
|
372
375
|
* Runs `self` while holding the named leader lock.
|
|
373
376
|
*/
|
|
374
|
-
export declare
|
|
377
|
+
export declare const withLeaderLock: {
|
|
378
|
+
<A, E, R>(options: LeaderLockOptions, lock: LeaderLock['Service']): (self: Effect.Effect<A, E, R>) => Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
379
|
+
<A, E, R>(self: Effect.Effect<A, E, R>, options: LeaderLockOptions, lock: LeaderLock['Service']): Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
380
|
+
};
|
|
375
381
|
|
|
376
382
|
/**
|
|
377
383
|
* Boots a worker. The leader-lock capability is acquired here, at the composition
|
|
@@ -22,7 +22,10 @@ declare const BoundedIntensity_base: Schema.Class<BoundedIntensity, Schema.Tagge
|
|
|
22
22
|
readonly window: Schema.Duration;
|
|
23
23
|
}>, {}>;
|
|
24
24
|
|
|
25
|
-
export declare const cappedBackoff:
|
|
25
|
+
export declare const cappedBackoff: {
|
|
26
|
+
(cap: Duration.Input): (base: Duration.Input) => Schedule.Schedule<Duration.Duration>;
|
|
27
|
+
(base: Duration.Input, cap: Duration.Input): Schedule.Schedule<Duration.Duration>;
|
|
28
|
+
};
|
|
26
29
|
|
|
27
30
|
export declare type Child<E, R> = Worker_2<E, R> | Supervisor<E, R>;
|
|
28
31
|
|
|
@@ -371,7 +374,10 @@ declare const UnboundedIntensity_base: Schema.Class<UnboundedIntensity, Schema.T
|
|
|
371
374
|
/**
|
|
372
375
|
* Runs `self` while holding the named leader lock.
|
|
373
376
|
*/
|
|
374
|
-
export declare
|
|
377
|
+
export declare const withLeaderLock: {
|
|
378
|
+
<A, E, R>(options: LeaderLockOptions, lock: LeaderLock['Service']): (self: Effect.Effect<A, E, R>) => Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
379
|
+
<A, E, R>(self: Effect.Effect<A, E, R>, options: LeaderLockOptions, lock: LeaderLock['Service']): Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
380
|
+
};
|
|
375
381
|
|
|
376
382
|
/**
|
|
377
383
|
* Boots a worker. The leader-lock capability is acquired here, at the composition
|
package/dist/index.d.ts
CHANGED
|
@@ -63,7 +63,10 @@ export declare class LockPrimitive extends LockPrimitive_base {}
|
|
|
63
63
|
export declare const LeaderLockFromPrimitive: Layer.Layer<LeaderLock, never, LockPrimitive>;
|
|
64
64
|
//#endregion
|
|
65
65
|
//#region src/Backoff.d.ts
|
|
66
|
-
export declare const cappedBackoff:
|
|
66
|
+
export declare const cappedBackoff: {
|
|
67
|
+
(cap: Duration.Input): (base: Duration.Input) => Schedule.Schedule<Duration.Duration>;
|
|
68
|
+
(base: Duration.Input, cap: Duration.Input): Schedule.Schedule<Duration.Duration>;
|
|
69
|
+
};
|
|
67
70
|
//#endregion
|
|
68
71
|
//#region src/Brands.d.ts
|
|
69
72
|
export declare const WorkerTypeId: unique symbol;
|
|
@@ -276,7 +279,10 @@ interface LeaderLockOptions {
|
|
|
276
279
|
/**
|
|
277
280
|
* Runs `self` while holding the named leader lock.
|
|
278
281
|
*/
|
|
279
|
-
export declare
|
|
282
|
+
export declare const withLeaderLock: {
|
|
283
|
+
<A, E, R>(options: LeaderLockOptions, lock: LeaderLock['Service']): (self: Effect.Effect<A, E, R>) => Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
284
|
+
<A, E, R>(self: Effect.Effect<A, E, R>, options: LeaderLockOptions, lock: LeaderLock['Service']): Effect.Effect<A | void, E | LeaderLockAcquireError, R>;
|
|
285
|
+
};
|
|
280
286
|
//#endregion
|
|
281
287
|
//#region src/SupervisionCustom.d.ts
|
|
282
288
|
declare const custom: <P>(policy: P) => Effect.Effect<P>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Array, Cause, Clock, Context, Duration, Effect, Equal, Exit, Fiber, HashMap, Latch, Layer, Match, Metric, Option, Predicate, Ref, Result, Schedule, Schema, SchemaGetter, Scope, Stream } from "effect";
|
|
1
|
+
import { Array, Cause, Clock, Context, Duration, Effect, Equal, Exit, Fiber, Function, HashMap, Latch, Layer, Match, Metric, Option, Predicate, Ref, Result, Schedule, Schema, SchemaGetter, Scope, Stream } from "effect";
|
|
2
2
|
import { Sandwich, Workflow } from "@systemfsoftware/effect-cell-types";
|
|
3
3
|
import * as Arr from "effect/Array";
|
|
4
4
|
import * as Match$1 from "effect/Match";
|
|
@@ -6,10 +6,10 @@ import "effect/Option";
|
|
|
6
6
|
import * as Result$1 from "effect/Result";
|
|
7
7
|
import * as S from "effect/Schema";
|
|
8
8
|
//#region src/Backoff.ts
|
|
9
|
-
const cappedBackoff = (base, cap) => {
|
|
9
|
+
const cappedBackoff = Function.dual(2, (base, cap) => {
|
|
10
10
|
const ceiling = Duration.fromInputUnsafe(cap);
|
|
11
11
|
return Schedule.exponential(base).pipe(Schedule.jittered, Schedule.modifyDelay(({ duration }) => Effect.succeed(Duration.min(duration, ceiling))));
|
|
12
|
-
};
|
|
12
|
+
});
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/Brands.ts
|
|
15
15
|
const WorkerTypeId = Symbol.for("@systemfsoftware/effect-daemon/Worker");
|
|
@@ -206,7 +206,7 @@ const LeaderLockFromPrimitive = Layer.effect(LeaderLock, Effect.gen(function* ()
|
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/internal/AllocateSupervisorHealth.ts
|
|
208
208
|
/** @internal */
|
|
209
|
-
const allocateSupervisorHealth = (name, children) => Effect.gen(function* () {
|
|
209
|
+
const allocateSupervisorHealth = Function.dual(2, (name, children) => Effect.gen(function* () {
|
|
210
210
|
const ready = yield* Latch.make(false);
|
|
211
211
|
const healthy = yield* Latch.make(true);
|
|
212
212
|
const paused = yield* Latch.make(true);
|
|
@@ -229,7 +229,7 @@ const allocateSupervisorHealth = (name, children) => Effect.gen(function* () {
|
|
|
229
229
|
paused,
|
|
230
230
|
children
|
|
231
231
|
};
|
|
232
|
-
});
|
|
232
|
+
}));
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/internal/AllocateWorkerHealth.ts
|
|
235
235
|
/** @internal */
|
|
@@ -332,7 +332,7 @@ const buildSubscriptionLoop = (worker, loop, health, readyGauge) => {
|
|
|
332
332
|
return wrapSpan(worker, body.pipe(Effect.asVoid));
|
|
333
333
|
};
|
|
334
334
|
/** @internal */
|
|
335
|
-
const buildWorkerLoop = (worker, health, readyGauge) => Match.value(worker.loop).pipe(Match.tag("Poll", (loop) => buildPollLoop(worker, loop, health, readyGauge)), Match.tag("Stream", (loop) => buildStreamLoop(worker, loop, health, readyGauge)), Match.tag("Subscription", (loop) => buildSubscriptionLoop(worker, loop, health, readyGauge)), Match.exhaustive);
|
|
335
|
+
const buildWorkerLoop = Function.dual(3, (worker, health, readyGauge) => Match.value(worker.loop).pipe(Match.tag("Poll", (loop) => buildPollLoop(worker, loop, health, readyGauge)), Match.tag("Stream", (loop) => buildStreamLoop(worker, loop, health, readyGauge)), Match.tag("Subscription", (loop) => buildSubscriptionLoop(worker, loop, health, readyGauge)), Match.exhaustive));
|
|
336
336
|
//#endregion
|
|
337
337
|
//#region src/RunDynamic.ts
|
|
338
338
|
const buildDynamic = (spec, health) => Effect.gen(function* () {
|
|
@@ -521,8 +521,8 @@ const DecideInputBase = Schema.Struct({
|
|
|
521
521
|
}).check(Schema.makeFilter(failedIndexAddressesAChild, { message: BOUND_MESSAGE }));
|
|
522
522
|
/**
|
|
523
523
|
* The restart command. A `Schema.Class` rather than a `Schema.Struct` because `Workflow.make`
|
|
524
|
-
*
|
|
525
|
-
*
|
|
524
|
+
* constrains its `command` on the class itself — a struct carries no `identifier` and no
|
|
525
|
+
* `extend`, and the constraint refuses it. Every field schema and the cross-field check are
|
|
526
526
|
* the ones the struct carried.
|
|
527
527
|
*
|
|
528
528
|
* Class-level `toCodecArbitrary` is what `Arbitrary.schema(DecideInput)` compiles. The
|
|
@@ -535,7 +535,7 @@ var DecideInput = class DecideInput extends Schema.Class("DecideInput")(DecideIn
|
|
|
535
535
|
decode: SchemaGetter.transform((generated) => new DecideInput(commandFromGenerated(generated))),
|
|
536
536
|
encode: SchemaGetter.transform(generatedFromCommand)
|
|
537
537
|
}) }) {
|
|
538
|
-
static [Workflow.InstrumentationBrand] =
|
|
538
|
+
static [Workflow.InstrumentationBrand] = { strategy: "daemon.restart.strategy" };
|
|
539
539
|
};
|
|
540
540
|
//#endregion
|
|
541
541
|
//#region src/internal/choose-restart-strategy.workflow.ts
|
|
@@ -560,22 +560,34 @@ var RestartDecisionRestart = class extends S.TaggedClass()("Restart", { indices:
|
|
|
560
560
|
var RestartDecisionExhausted = class extends S.TaggedError()("Exhausted", {}) {
|
|
561
561
|
[RestartDecisionTypeId] = RestartDecisionTypeId;
|
|
562
562
|
};
|
|
563
|
+
/**
|
|
564
|
+
* The decision channel: the two outcomes a cooldown-or-restart choice is made between, as
|
|
565
|
+
* one schema the workflow declares. The error channel carries `RestartDecisionExhausted`, so
|
|
566
|
+
* the compiler holds the three-way dispatch over the encoded tags of both channels.
|
|
567
|
+
*/
|
|
563
568
|
/** @internal */
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
569
|
+
const RestartDecision = S.Union([RestartDecisionContinue, RestartDecisionRestart]);
|
|
570
|
+
/** @internal */
|
|
571
|
+
const chooseRestartStrategy = Workflow.make({
|
|
572
|
+
command: DecideInput,
|
|
573
|
+
decision: RestartDecision,
|
|
574
|
+
error: RestartDecisionExhausted,
|
|
575
|
+
decide: (command) => Match$1.value(command).pipe(Match$1.when({ exitSuccess: true }, () => Result$1.succeed(RestartDecisionContinue.make())), Match$1.when({
|
|
576
|
+
exitSuccess: false,
|
|
577
|
+
intensityExceeded: true
|
|
578
|
+
}, () => Result$1.fail(RestartDecisionExhausted.make())), Match$1.orElse(() => Result$1.succeed(RestartDecisionRestart.make({ indices: restartIndicesFor(command.strategy, command.failedIndex, command.totalChildren) }))))
|
|
579
|
+
});
|
|
568
580
|
//#endregion
|
|
569
581
|
//#region src/internal/IntensityWindow.ts
|
|
570
582
|
/** @internal */
|
|
571
|
-
const isWithinWindow = (now, windowMillis) =>
|
|
583
|
+
const isWithinWindow = Function.dual(3, (t, now, windowMillis) => now - t <= windowMillis);
|
|
572
584
|
const keepWithin = (now, windowMillis) => (ts) => ts.filter(isWithinWindow(now, windowMillis));
|
|
573
585
|
/** @internal */
|
|
574
|
-
const pruneTimestamps = (ts, now, windowMillis) => keepWithin(now, windowMillis)(ts);
|
|
586
|
+
const pruneTimestamps = Function.dual(3, (ts, now, windowMillis) => keepWithin(now, windowMillis)(ts));
|
|
575
587
|
/** @internal */
|
|
576
|
-
const recordTimestamp = (ts, now, windowMillis) => [now, ...pruneTimestamps(ts, now, windowMillis)];
|
|
588
|
+
const recordTimestamp = Function.dual(3, (ts, now, windowMillis) => [now, ...pruneTimestamps(ts, now, windowMillis)]);
|
|
577
589
|
/** @internal */
|
|
578
|
-
const exceedsRestarts = (count, restarts) => count > restarts;
|
|
590
|
+
const exceedsRestarts = Function.dual(2, (count, restarts) => count > restarts);
|
|
579
591
|
//#endregion
|
|
580
592
|
//#region src/internal/Intensity.ts
|
|
581
593
|
/** @internal */
|
|
@@ -585,7 +597,7 @@ const neverExceeds = {
|
|
|
585
597
|
count: Effect.succeed(0)
|
|
586
598
|
};
|
|
587
599
|
/** @internal */
|
|
588
|
-
const make = (restarts, window) => Effect.gen(function* () {
|
|
600
|
+
const make = Function.dual(2, (restarts, window) => Effect.gen(function* () {
|
|
589
601
|
const windowMillis = Duration.toMillis(window);
|
|
590
602
|
const timestamps = yield* Ref.make([]);
|
|
591
603
|
const prune = (now) => Ref.modify(timestamps, (ts) => {
|
|
@@ -607,7 +619,7 @@ const make = (restarts, window) => Effect.gen(function* () {
|
|
|
607
619
|
return (yield* prune(now)).length;
|
|
608
620
|
})
|
|
609
621
|
};
|
|
610
|
-
});
|
|
622
|
+
}));
|
|
611
623
|
//#endregion
|
|
612
624
|
//#region src/internal/RaceForExit.ts
|
|
613
625
|
/** @internal */
|
|
@@ -660,11 +672,11 @@ const withRequiredBackoff = (acquire, backoff) => {
|
|
|
660
672
|
/**
|
|
661
673
|
* Runs `self` while holding the named leader lock.
|
|
662
674
|
*/
|
|
663
|
-
|
|
675
|
+
const withLeaderLock = Function.dual(3, (self, options, lock) => {
|
|
664
676
|
const acquire = acquireWithLock(self, options, lock);
|
|
665
677
|
if (options.mode !== "required") return acquire;
|
|
666
678
|
return withRequiredBackoff(acquire, options.acquireRetryBackoff);
|
|
667
|
-
}
|
|
679
|
+
});
|
|
668
680
|
//#endregion
|
|
669
681
|
//#region src/internal/WithLockByModeExecutor.ts
|
|
670
682
|
/**
|
|
@@ -692,10 +704,10 @@ const withKeyedLock = (self, spec, lock) => {
|
|
|
692
704
|
}, lock);
|
|
693
705
|
};
|
|
694
706
|
/** @internal */
|
|
695
|
-
const withLockByMode = (self, binding) => {
|
|
707
|
+
const withLockByMode = Function.dual(2, (self, binding) => {
|
|
696
708
|
if (binding.kind === "unlocked") return self;
|
|
697
709
|
return withKeyedLock(self, binding.spec, binding.lock);
|
|
698
|
-
};
|
|
710
|
+
});
|
|
699
711
|
//#endregion
|
|
700
712
|
//#region src/internal/SupervisorBodyExecutor.ts
|
|
701
713
|
const handleExhausted = (ctx, cause) => Effect.gen(function* () {
|
|
@@ -718,25 +730,35 @@ const handleRestart = (ctx, cause, onSignal) => Effect.gen(function* () {
|
|
|
718
730
|
* The read is a bump-and-report: recording a restart is how the current rate is obtained, so
|
|
719
731
|
* the mutation is a product gathered across the read's interior rather than a write standing
|
|
720
732
|
* before a decision. That is what keeps this one layer instead of two, and it is why
|
|
721
|
-
* `intensity.record` sits where it does.
|
|
733
|
+
* `intensity.record` sits where it does. The read is also where the command's encoded form is
|
|
734
|
+
* gathered, so the library decodes it through the workflow's command schema before `decide`
|
|
735
|
+
* runs and encodes the decision or the refusal the workflow returns.
|
|
722
736
|
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
737
|
+
* The write dispatches one handler per encoded tag, and each handler answers with the epoch
|
|
738
|
+
* step that follows: a decision to continue stops the epoch, a decision to restart reports and
|
|
739
|
+
* reboots, and the `Exhausted` refusal cools down. A command the supervisor built that fails its
|
|
740
|
+
* own schema is a regression in this module, so it is logged and treated as exhausted: the
|
|
741
|
+
* supervisor cools down instead of dying and taking every child with it.
|
|
725
742
|
*
|
|
726
743
|
* A description is built per failure because the write needs that failure's context, and the
|
|
727
744
|
* phase signatures hand the command to the read alone. Restarts are rare, so the allocation is
|
|
728
745
|
* paid only when a supervised child has actually died.
|
|
729
746
|
*/
|
|
730
|
-
const restartDescription = (spec) => Sandwich.named("supervisor.restart-description")((intensity) => Effect.andThen(intensity.record, intensity.isExceeded)
|
|
747
|
+
const restartDescription = (spec) => Sandwich.named("supervisor.restart-description")((intensity) => Effect.map(Effect.andThen(intensity.record, intensity.isExceeded), (intensityExceeded) => ({
|
|
731
748
|
strategy: spec.strategy,
|
|
732
749
|
totalChildren: spec.totalChildren,
|
|
733
750
|
failedIndex: spec.failedIndex,
|
|
734
751
|
exitSuccess: false,
|
|
735
752
|
intensityExceeded
|
|
736
|
-
}))).decide(chooseRestartStrategy).
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
753
|
+
}))).decide(chooseRestartStrategy).write({
|
|
754
|
+
Continue: () => Effect.succeed(StopEpoch.make()),
|
|
755
|
+
Restart: (decision) => handleRestart(spec.ctx, spec.cause, spec.onRestart(decision)),
|
|
756
|
+
Exhausted: () => handleExhausted(spec.ctx, spec.cause),
|
|
757
|
+
CommandRejected: (rejected) => Effect.andThen(Effect.logError("supervisor restart command failed its own schema; cooling down", {
|
|
758
|
+
daemon: spec.ctx.name,
|
|
759
|
+
issue: String(rejected.issue)
|
|
760
|
+
}), handleExhausted(spec.ctx, spec.cause))
|
|
761
|
+
});
|
|
740
762
|
const reopenHealthyAfterCooldown = (ctx) => Effect.andThen(ctx.health.healthy.open, Metric.update(Metric.withAttributes(healthStateGauge, {
|
|
741
763
|
daemon: ctx.name,
|
|
742
764
|
latch: "healthy"
|
|
@@ -928,14 +950,14 @@ const bootChild = (child, reporter) => Effect.gen(function* () {
|
|
|
928
950
|
};
|
|
929
951
|
});
|
|
930
952
|
/** @internal */
|
|
931
|
-
const supervisor$1 = (s, reporter, binding) => Effect.gen(function* () {
|
|
953
|
+
const supervisor$1 = Function.dual(3, (s, reporter, binding) => Effect.gen(function* () {
|
|
932
954
|
const booted = yield* Effect.forEach(s.children, (child) => bootChild(child, reporter));
|
|
933
955
|
const health = yield* allocateSupervisorHealth(s.name, booted.map((b) => b.health));
|
|
934
956
|
const body = buildSupervisorBody(s, health, booted, reporter).pipe(Effect.orDie);
|
|
935
957
|
const locked = withLockByMode(body, binding);
|
|
936
958
|
yield* Effect.forkScoped(locked.pipe(Effect.orDie), { startImmediately: true });
|
|
937
959
|
return health;
|
|
938
|
-
});
|
|
960
|
+
}));
|
|
939
961
|
//#endregion
|
|
940
962
|
//#region src/LeaderLock.ts
|
|
941
963
|
const isModeNone = (lock) => lock.mode === "none";
|
|
@@ -963,13 +985,13 @@ const supervisor = (s) => Effect.gen(function* () {
|
|
|
963
985
|
});
|
|
964
986
|
//#endregion
|
|
965
987
|
//#region src/DaemonWorkerExecutor.ts
|
|
966
|
-
const worker$2 = (w, binding) => Effect.gen(function* () {
|
|
988
|
+
const worker$2 = Function.dual(2, (w, binding) => Effect.gen(function* () {
|
|
967
989
|
const health = yield* allocateWorkerHealth(w.name);
|
|
968
990
|
const loop = buildWorkerLoop(w, health, healthStateGauge).pipe(Effect.orDie);
|
|
969
991
|
const locked = withLockByMode(loop, binding);
|
|
970
992
|
yield* Effect.forkScoped(locked.pipe(Effect.orDie));
|
|
971
993
|
return health;
|
|
972
|
-
});
|
|
994
|
+
}));
|
|
973
995
|
//#endregion
|
|
974
996
|
//#region src/RunWorker.ts
|
|
975
997
|
/**
|
|
@@ -1001,11 +1023,11 @@ const LeaderConfig = Context.Reference("@systemfsoftware/effect-daemon-spec/Lead
|
|
|
1001
1023
|
intensity: UnboundedIntensity.make(),
|
|
1002
1024
|
cooldown: Duration.zero
|
|
1003
1025
|
}) });
|
|
1004
|
-
const leader$1 = (config, cap) => Effect.succeed({
|
|
1026
|
+
const leader$1 = Function.dual(2, (config, cap) => Effect.succeed({
|
|
1005
1027
|
intensity: config.intensity,
|
|
1006
1028
|
backoff: cappedBackoff(config.backoffBase, cap),
|
|
1007
1029
|
cooldown: config.cooldown
|
|
1008
|
-
});
|
|
1030
|
+
}));
|
|
1009
1031
|
//#endregion
|
|
1010
1032
|
//#region src/SupervisionTask.ts
|
|
1011
1033
|
const TaskConfig = Context.Reference("@systemfsoftware/effect-daemon-spec/TaskConfig", { defaultValue: () => ({
|
|
@@ -1013,11 +1035,11 @@ const TaskConfig = Context.Reference("@systemfsoftware/effect-daemon-spec/TaskCo
|
|
|
1013
1035
|
intensity: UnboundedIntensity.make(),
|
|
1014
1036
|
cooldown: Duration.zero
|
|
1015
1037
|
}) });
|
|
1016
|
-
const task$1 = (config, budget) => Effect.succeed({
|
|
1038
|
+
const task$1 = Function.dual(2, (config, budget) => Effect.succeed({
|
|
1017
1039
|
intensity: config.intensity,
|
|
1018
1040
|
backoff: Schedule.exponential(config.backoffBase).pipe(Schedule.jittered, Schedule.upTo({ duration: budget })),
|
|
1019
1041
|
cooldown: config.cooldown
|
|
1020
|
-
});
|
|
1042
|
+
}));
|
|
1021
1043
|
//#endregion
|
|
1022
1044
|
//#region src/SupervisionWorker.ts
|
|
1023
1045
|
const WorkerConfig = Context.Reference("@systemfsoftware/effect-daemon-spec/WorkerConfig", { defaultValue: () => ({
|
|
@@ -1028,11 +1050,11 @@ const WorkerConfig = Context.Reference("@systemfsoftware/effect-daemon-spec/Work
|
|
|
1028
1050
|
}),
|
|
1029
1051
|
cooldown: Duration.seconds(30)
|
|
1030
1052
|
}) });
|
|
1031
|
-
const worker$1 = (config, cap) => Effect.succeed({
|
|
1053
|
+
const worker$1 = Function.dual(2, (config, cap) => Effect.succeed({
|
|
1032
1054
|
intensity: config.intensity,
|
|
1033
1055
|
backoff: cappedBackoff(config.backoffBase, cap),
|
|
1034
1056
|
cooldown: config.cooldown
|
|
1035
|
-
});
|
|
1057
|
+
}));
|
|
1036
1058
|
//#endregion
|
|
1037
1059
|
//#region src/SupervisorOneForAll.ts
|
|
1038
1060
|
const oneForAll$1 = (opts) => ({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/effect-daemon-spec",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -37,18 +37,26 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@systemfsoftware/effect-cell-types": "^
|
|
40
|
+
"@systemfsoftware/effect-cell-types": "^10.1.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@effect/vitest": "4.0.0-rc.116",
|
|
44
44
|
"@microsoft/api-extractor": "^7.59.1",
|
|
45
45
|
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
46
|
-
"@systemfsoftware/
|
|
47
|
-
"@systemfsoftware/
|
|
48
|
-
"@systemfsoftware/
|
|
49
|
-
"@systemfsoftware/
|
|
50
|
-
"@systemfsoftware/stryker-
|
|
46
|
+
"@systemfsoftware/effect-gherkin-spec": "^4.3.0",
|
|
47
|
+
"@systemfsoftware/effect-schema-law": "^2.3.0",
|
|
48
|
+
"@systemfsoftware/effect-schema-vite": "^2.2.2",
|
|
49
|
+
"@systemfsoftware/oxlint-config-recommended": "^2.0.0",
|
|
50
|
+
"@systemfsoftware/stryker-config": "^0.1.0",
|
|
51
|
+
"@systemfsoftware/stryker-ignorer-effect-schema-declarations": "^0.1.1",
|
|
52
|
+
"@systemfsoftware/stryker-ignorer-in-source-vitest-block": "^0.1.1",
|
|
53
|
+
"@systemfsoftware/stryker-js": "^10.1.1",
|
|
54
|
+
"@systemfsoftware/stryker-js-typescript-checker": "^7.0.5",
|
|
55
|
+
"@systemfsoftware/stryker-js-vitest-runner": "^7.1.1",
|
|
51
56
|
"@systemfsoftware/stryker-test-contribution": "^3.0.3",
|
|
57
|
+
"@systemfsoftware/tsconfig": "^2.0.0",
|
|
58
|
+
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
59
|
+
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
52
60
|
"@types/node": "^26",
|
|
53
61
|
"@vitest/coverage-v8": "^5",
|
|
54
62
|
"effect": "4.0.0-rc.116",
|
|
@@ -57,15 +65,7 @@
|
|
|
57
65
|
"rimraf": "^6.1.3",
|
|
58
66
|
"tsdown": "^0.23.0",
|
|
59
67
|
"typescript": "^7",
|
|
60
|
-
"vitest": "^5"
|
|
61
|
-
"@systemfsoftware/effect-gherkin-spec": "^4.2.2",
|
|
62
|
-
"@systemfsoftware/effect-schema-law": "^2.2.1",
|
|
63
|
-
"@systemfsoftware/oxlint-config-recommended": "^1.1.0",
|
|
64
|
-
"@systemfsoftware/stryker-config": "^0.1.0",
|
|
65
|
-
"@systemfsoftware/tsconfig": "^1.3.6",
|
|
66
|
-
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
67
|
-
"@systemfsoftware/effect-schema-vite": "^2.2.1",
|
|
68
|
-
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
68
|
+
"vitest": "^5"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"effect": "4.0.0-rc.116"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"scripts": {
|
|
77
77
|
"clean": "rimraf dist",
|
|
78
78
|
"build": "tsdown -l warn && pnpm api:check",
|
|
79
|
-
"typecheck": "tsc
|
|
79
|
+
"typecheck": "tsc -b",
|
|
80
80
|
"test": "vitest run",
|
|
81
81
|
"mutation": "stryker run",
|
|
82
82
|
"mutation:full": "stryker run --force",
|