effect-distributed-lock 0.0.7 → 0.0.8
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.
|
@@ -57,9 +57,7 @@ const runScenario = (name: string, pushEnabled: boolean) =>
|
|
|
57
57
|
const mutex = yield* DistributedSemaphore.make(
|
|
58
58
|
`concurrent-example-${pushEnabled ? "push" : "poll"}`,
|
|
59
59
|
{
|
|
60
|
-
acquireRetryPolicy: Schedule.spaced(Duration.millis(500))
|
|
61
|
-
Schedule.asVoid
|
|
62
|
-
),
|
|
60
|
+
acquireRetryPolicy: Schedule.spaced(Duration.millis(500)),
|
|
63
61
|
limit: 1, // Mutex - only one holder at a time
|
|
64
62
|
}
|
|
65
63
|
);
|
package/package.json
CHANGED
|
@@ -44,7 +44,7 @@ export interface DistributedSemaphoreConfig {
|
|
|
44
44
|
* How often to poll when waiting to acquire permits.
|
|
45
45
|
* @default Schedule.spaced(Duration.millis(100))
|
|
46
46
|
*/
|
|
47
|
-
readonly acquireRetryPolicy?: Schedule.Schedule<
|
|
47
|
+
readonly acquireRetryPolicy?: Schedule.Schedule<unknown>;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Retry policy when a backing failure occurs.
|
|
@@ -54,15 +54,13 @@ export interface DistributedSemaphoreConfig {
|
|
|
54
54
|
* - Releasing permits
|
|
55
55
|
* @default Schedule.recurs(3)
|
|
56
56
|
*/
|
|
57
|
-
readonly backingFailureRetryPolicy?: Schedule.Schedule<
|
|
57
|
+
readonly backingFailureRetryPolicy?: Schedule.Schedule<unknown>;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const DEFAULT_LIMIT = 1;
|
|
61
61
|
const DEFAULT_TTL = Duration.seconds(30);
|
|
62
|
-
const DEFAULT_ACQUIRE_RETRY_POLICY = Schedule.spaced(Duration.millis(100))
|
|
63
|
-
|
|
64
|
-
);
|
|
65
|
-
const DEFAULT_FAILURE_RETRY_POLICY = Schedule.recurs(3).pipe(Schedule.asVoid);
|
|
62
|
+
const DEFAULT_ACQUIRE_RETRY_POLICY = Schedule.spaced(Duration.millis(100));
|
|
63
|
+
const DEFAULT_FAILURE_RETRY_POLICY = Schedule.recurs(3);
|
|
66
64
|
|
|
67
65
|
// =============================================================================
|
|
68
66
|
// Acquire Options
|
|
@@ -222,8 +220,8 @@ type FullyResolvedConfig = {
|
|
|
222
220
|
limit: number;
|
|
223
221
|
ttl: Duration.Duration;
|
|
224
222
|
refreshInterval: Duration.Duration;
|
|
225
|
-
acquireRetryPolicy: Schedule.Schedule<
|
|
226
|
-
backingFailureRetryPolicy: Schedule.Schedule<
|
|
223
|
+
acquireRetryPolicy: Schedule.Schedule<unknown>;
|
|
224
|
+
backingFailureRetryPolicy: Schedule.Schedule<unknown>;
|
|
227
225
|
};
|
|
228
226
|
|
|
229
227
|
function fullyResolveConfig(
|
package/src/RedisBacking.ts
CHANGED
|
@@ -177,7 +177,7 @@ export interface RedisBackingOptions {
|
|
|
177
177
|
* How often to retry the stream of notifications when permits are released.
|
|
178
178
|
* @default Schedule.forever
|
|
179
179
|
*/
|
|
180
|
-
readonly pushStreamRetrySchedule?: Schedule.Schedule<
|
|
180
|
+
readonly pushStreamRetrySchedule?: Schedule.Schedule<unknown>;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/**
|
|
@@ -198,7 +198,7 @@ export const layer = (
|
|
|
198
198
|
const keyPrefix = options.keyPrefix ?? "semaphore:";
|
|
199
199
|
const pushBasedAcquireEnabled = options.pushBasedAcquireEnabled ?? true;
|
|
200
200
|
const pushStreamRetrySchedule =
|
|
201
|
-
options.pushStreamRetrySchedule ?? Schedule.forever
|
|
201
|
+
options.pushStreamRetrySchedule ?? Schedule.forever;
|
|
202
202
|
const prefixKey = (key: string) => `${keyPrefix}${key}`;
|
|
203
203
|
const releaseChannel = (key: string) => `${keyPrefix}${key}:released`;
|
|
204
204
|
|