refactor(telegram): derive STALE_THROTTLE_MS from TRANSIENT_RETRY_DELAY_MS - #42
Conversation
…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>
|
| 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)"]
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>
Summary
Addresses greptile style nit from PR #40:
STALE_THROTTLE_MSis now expressed asTRANSIENT_RETRY_DELAY_MS + 10_000Lrather 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