Understanding `TestClock` and `Effect.retry` in Effect Typescript

When using a TestClock and Effect.retry, why do I have to yield in intervals?

I have a simple workflow utility, that uses Effect.retry:

const schedule = pipe(
        Schedule.exponential(Duration.millis(initialDelay), backoffMultiplier),
        Schedule.union(Schedule.spaced(Duration.millis(maxDelay))),
        Schedule.intersect(Schedule.recurs(times))
      );

 return pipe(effect, Effect.retry(schedule));


However, I have to yield* each retry step individually, so the effect (which updates a ref in the test) runs

 const worker = WorkflowWorkerBuilder.make('test-worker', {
        concurrency: 1,
        pollInterval,
      })
        .addWorkflow(TestWorkflow)
        .buildLayer()
        .pipe(Layer.provide(TestWorkflowLive));

      yield* Effect.fork(Layer.launch(worker));

      // Poll and claim workflow
      yield* TestClock.adjust(pollInterval);

      //Just doing yield* TestClock.adjust(Duration.seconds(10)) wont work, deferred will         not be resolved


      yield* TestClock.adjust(Duration.seconds(1));

      // Retry 2 happens after 2 second delay (exponential backoff)
      yield* TestClock.adjust(Duration.seconds(2));

      // Give time for final attempt to complete
      yield* TestClock.adjust(Duration.seconds(4));

      // Wait for workflow to complete
      yield* Deferred.await(workflowCompleted).pipe(Effect.timeout(Duration.seconds(5)));


If I were to do TestClock.adjust(30s) it wouldnt perform each action, and thus not resolve the deferred

Or is that some weird condition where I block the runtime?
Was this page helpful?