Skip to content

refactor(telegram): derive STALE_THROTTLE_MS from TRANSIENT_RETRY_DELAY_MS - #42

Merged
robster7674 merged 2 commits into
glucodroidfrom
fix/stale-throttle-derive
Jun 9, 2026
Merged

refactor(telegram): derive STALE_THROTTLE_MS from TRANSIENT_RETRY_DELAY_MS#42
robster7674 merged 2 commits into
glucodroidfrom
fix/stale-throttle-derive

Conversation

@robster7674

Copy link
Copy Markdown
Owner

Summary

Addresses greptile style nit from PR #40: STALE_THROTTLE_MS is now expressed as TRANSIENT_RETRY_DELAY_MS + 10_000L rather than a bare magic constant. This makes the invariant (STALE_THROTTLE_MS > TRANSIENT_RETRY_DELAY_MS) self-enforcing — changing either constant cannot silently break the relationship.

No behavioral change; value remains 70 000 ms.

🤖 Generated with Claude Code

…AY_MS

Addresses greptile style nit from PR #40: expressing STALE_THROTTLE_MS as
TRANSIENT_RETRY_DELAY_MS + 10_000L makes the invariant (throttle > retry
delay) self-enforcing — a future edit to either constant cannot accidentally
break the relationship.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown

Greptile Summary

Purely cosmetic/constant-derivation refactor: STALE_THROTTLE_MS is no longer a bare magic number but is expressed as TRANSIENT_RETRY_DELAY_MS + 10_000L, keeping the > invariant self-enforcing. The redundant usage-site comment that restated the same invariant in prose is removed. No runtime behaviour changes.

  • STALE_THROTTLE_MS value stays at 70 000 ms; only its definition form changes.
  • Three lines of now-redundant usage-site commentary are cleanly removed.

Confidence Score: 5/5

Safe to merge — the computed value of STALE_THROTTLE_MS is identical to the removed literal, and the only other change is deleting a now-redundant comment.

The change is a single constant re-expression (60 000 + 10 000 = 70 000) and a comment deletion. Kotlin permits compile-time arithmetic on const vals, so there is no runtime difference whatsoever.

No files require special attention.

Important Files Changed

Filename Overview
Common/src/main/java/tk/glucodata/TelegramStaleCheckWork.kt STALE_THROTTLE_MS is now derived as TRANSIENT_RETRY_DELAY_MS + 10_000L (still 70 000 ms); redundant usage-site comment is removed. No logic change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["TRANSIENT_RETRY_DELAY_MS = 60 000 ms"] --> B["STALE_THROTTLE_MS = TRANSIENT_RETRY_DELAY_MS + 10 000 ms\n= 70 000 ms"]
    B --> C{lastStaleMs > 0\nAND now - lastStaleMs < STALE_THROTTLE_MS?}
    C -- Yes --> D["Skip recipient\n(throttled)"]
    C -- No --> E["Send stale/missed message"]
    E --> F{Result}
    F -- true --> G["Record staleAt, reschedule if STALE"]
    F -- false --> H["Clear recipient state"]
    F -- null --> I["Retry after TRANSIENT_RETRY_DELAY_MS (60 s)"]
Loading

Reviews (2): Last reviewed commit: "refactor(telegram): drop redundant invar..." | Re-trigger Greptile

The STALE_THROTTLE_MS > TRANSIENT_RETRY_DELAY_MS invariant is now
self-evident from the constant definition; restating it at the call site
adds noise without adding information.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@robster7674
robster7674 merged commit 09e06ae into glucodroid Jun 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant