Skip to content

refactor(services)!: use typed durations for moka configs - #8033

Open
subotac wants to merge 1 commit into
apache:mainfrom
subotac:refactor/typed-moka-durations
Open

refactor(services)!: use typed durations for moka configs#8033
subotac wants to merge 1 commit into
apache:mainfrom
subotac:refactor/typed-moka-durations

Conversation

@subotac

@subotac subotac commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #8025

Rationale for this change

Moka and MiniMoka are the remaining services that keep cache durations as strings and parse them again during backend construction. Their builders also format Duration::as_secs(), which truncates subsecond values
before parsing.

What changes are included in this PR?

  • Store Moka and MiniMoka TTL/TTI config values as SignedDuration.
  • Convert configured values with signed_duration_to_duration
  • Keep builder-provided Duration values as lossless overrides
  • Add config parsing and builder precision regression tests

Are there any user-facing changges?

Yes. MokaConfig and MiniMokaConfig now expose Option<SignedDuration> for time_to_live and time_to_idle instead of Option<String>. String-based configuration continues to accept duration values such as
1500ms

@subotac
subotac requested a review from Xuanwo as a code owner August 6, 2026 16:47
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" labels Aug 6, 2026
@Xuanwo Xuanwo changed the title refactor(services): use typed durations for moka configs refactor(services)!: use typed durations for moka configs Aug 6, 2026
@Xuanwo

Xuanwo commented Aug 6, 2026

Copy link
Copy Markdown
Member

Hold on this PR until our next patch version released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-changes releases-note/refactor The PR does a refactor on code or has a title that begins with "refactor" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investiagte the usage signed_to_duration

2 participants