Possible double initialization of a Layer in `Layer` construction

Is it possible that somehow a Layer is initialized twice? I have my own ManagedRuntime that I only construct once, and all my services are also only constructed once (in theory) but somehow I can see that a make function is called twice:
export class Scheduler extends Context.Tag("Service/Scheduler")<
    Scheduler,
    { ... }
>() {}

const make = gen(function*() {
    yield* logDebug("Preparing");
    // ...
});

export const layer = Layer.effect(Scheduler, make);

const SchedulerLive = Scheduler.layer.pipe(
    Layer.provide(
        Layer.mergeAll(PrismaJobRepository.live, Timer.live, UUIDProvider.live),
    ),
);

export const ServicesLive = pipe(
    Layer.mergeAll(
        ...
        SchedulerLive,
    ),
    Layer.provide(Logger.minimumLogLevel(LogLevel.Debug)),
);

export const LARISEL_RUNTIME = ManagedRuntime.make(ServicesLive);

I see "Preparing" twice! Is it possible that setTimeout somehow interferes with effect? I'm using setTimeout to call a function repeatedly that uses this service (and the runtime)
Was this page helpful?