Repository navigation
clock: Inara modules that need a clock require the ClockModule - #127
Merged
Merged
Conversation
The Inara PeriodicModule, KubernetesLeaderElectionModule, DbSchedulerModule, OpenTelemetryModule and ServiceStartTracingModule require boot-clock's ClockModule, and their builders lose their clock parameter. An application chooses its clock once, with clockModule(), and a test replaces it once, with clockModule(testClock), as the Koin and Metro flavors already do with their shared Clock binding. A module that needs a clock no longer falls back to Clock.System when the application forgets to pass its clock: leaving out the ClockModule doesn't compile. The tests, the Inara doc snippets and the Inara example compose the ClockModule, and the docs say where the Inara modules take their clock.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Inara modules that need a clock now require boot-clock's
ClockModule, instead of taking a clock as a builder parameter:PeriodicModule(boot-periodic)KubernetesLeaderElectionModule(boot-leader-k8s)DbSchedulerModule(boot-scheduler-db)OpenTelemetryModuleandServiceStartTracingModule(boot-telemetry-otel)Their builders, such as
periodicModule(), lose theirclockparameter, and each of these projects' Inara flavor depends on boot-clock's Inara flavor (published asboot-clock-inara).An application chooses its clock once, by composing
clockModule(), and a test replaces it once, withclockModule(testClock). That matches the Koin and Metro flavors, whose modules already read one sharedClockbinding.Before, an application passed its clock to each builder, and a builder it missed silently used
Clock.System. Now, leaving out theClockModuleis a compile error. Applications that compose none of these modules don't need boot-clock.This changes the Inara builders' signatures. The Inara flavor is unreleased (3.1.0).
Other changes
ClockModule.clockModule(clock).ClockWiringTestpicks the Kodein and InaraclockModuleby typed references: they have the same name and signature.SessionsModulerequires theClockModuletoo, so its test sets one clock for the SDK and the sessions.ClockModule.ClockModule's KDoc says the Bootable modules that need a clock require it.Test plan
./gradlew build