You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 2021 in 2e60d31#diff-c0a47ac7efd8e71eeae297ce15149f4aa41d51751b9a6e4be12af6f34362bc89, Scotte Zinn introduced the CronModule and FakeCronModule. I now believe that the 'Fake' is a misnomer. It seems as if Scotte intended to either inline the `FakeCronModule, rename it, or further split apart the real and fake dependencies.
My first clue is that the real CronModule installs the FakeCronModule. It is atypical for real modules to depend on fake modules.
The FakeCronModule installs an ExecutorServiceModule such that the Guice dependency map includes an ExecutorService. However that ExecutorService is unused – nothing installed via FakeCronModule alone is using the ExecutorService to execute anything. It can be observe in the logs that CronManager adds each of the expected cron entries, but no logs from misk-cron-cronjob-%d occur and the individual CronRunnableEntry instances are not invoked.
The real CronModule provides a RepeatedTaskQueue which corresponds to the fake's ExecutorService via the @ForMiskCron annotation.
Proposed Solution
The FakeCronModule should be removed and its configuration inlined into the real CronModule. This will be a breaking change to users of the FakeCronModule.
In my opinion this is a valuable breaking change, as users of the FakeCronModule are likely not experiencing the behavior the expect.
The text was updated successfully, but these errors were encountered:
tklovett
changed the title
Every CronEntry should executed during local development (CronModule vs FakeCronModule)
Every CronEntry should execute during local development (CronModule vs FakeCronModule)
Aug 6, 2024
Module:
misk-cron
Context
In 2021 in 2e60d31#diff-c0a47ac7efd8e71eeae297ce15149f4aa41d51751b9a6e4be12af6f34362bc89, Scotte Zinn introduced the
CronModule
andFakeCronModule
. I now believe that the 'Fake' is a misnomer. It seems as if Scotte intended to either inline the `FakeCronModule, rename it, or further split apart the real and fake dependencies.My first clue is that the real
CronModule
installs theFakeCronModule
. It is atypical for real modules to depend on fake modules.The
FakeCronModule
installs anExecutorServiceModule
such that the Guice dependency map includes anExecutorService
. However thatExecutorService
is unused – nothing installed viaFakeCronModule
alone is using theExecutorService
to execute anything. It can be observe in the logs thatCronManager
adds each of the expected cron entries, but no logs frommisk-cron-cronjob-%d
occur and the individualCronRunnableEntry
instances are not invoked.The real
CronModule
provides aRepeatedTaskQueue
which corresponds to the fake'sExecutorService
via the@ForMiskCron
annotation.Proposed Solution
The
FakeCronModule
should be removed and its configuration inlined into the realCronModule
. This will be a breaking change to users of theFakeCronModule
.In my opinion this is a valuable breaking change, as users of the
FakeCronModule
are likely not experiencing the behavior the expect.The text was updated successfully, but these errors were encountered: