Skip to content

refactor(token-scheduler): change token scheduling from days to hours - #423

Open
egalvis27 wants to merge 1 commit into
mainfrom
feat/change-token-scheduler-to-hours
Open

refactor(token-scheduler): change token scheduling from days to hours#423
egalvis27 wants to merge 1 commit into
mainfrom
feat/change-token-scheduler-to-hours

Conversation

@egalvis27

@egalvis27 egalvis27 commented Jul 24, 2026

Copy link
Copy Markdown

What is Changed / Added

  • Refactored the token refresh scheduler to use hours directly instead of converting hours into days.
  • Updated the token renewal logic so the refresh window is calculated from the configured hours-before value.
  • Adjusted the auth schedule creation flow to pass the new hour-based renewal interval.
  • Updated the related tests to reflect the new hour-based behavior and keep the scheduler coverage aligned with the implementation.

Why

  • The authentication flow changed from day-based expiration handling to hour-based handling, and the scheduler logic needed to reflect that change.
  • This makes the refresh timing more accurate and removes the previous awkward conversion logic.
  • The refactor improves clarity, reduces confusion in maintenance, and keeps the behavior consistent with the current product requirements.

Summary by CodeRabbit

  • Bug Fixes

    • Improved token renewal scheduling by calculating renewal times in hours, helping ensure tokens are refreshed at the intended time before expiration.
    • Preserved existing retry, cancellation, and token validation behavior.
  • Chores

    • Updated development tooling libraries.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 15201649-6277-485c-a914-97362af6b77f

📥 Commits

Reviewing files that changed from the base of the PR and between a501b2e and ad68543.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json
  • src/apps/main/auth/refresh-token/create-token-schedule-with-retry.ts
  • src/apps/main/token-scheduler/TokenScheduler.ts
  • src/apps/main/token-scheduler/token-scheduler.test.ts

📝 Walkthrough

Walkthrough

Token renewal scheduling changes its lead-time unit from days to hours. The scheduler, refresh-token wiring, and related tests now use hour-based calculations. The development dependency on @internxt/lib is also updated.

Changes

Token Renewal Scheduling

Layer / File(s) Summary
Hour-based scheduling calculation and wiring
src/apps/main/token-scheduler/TokenScheduler.ts, src/apps/main/auth/refresh-token/create-token-schedule-with-retry.ts, package.json
TokenScheduler and refresh-token scheduling now calculate and pass renewal windows in hours. The @internxt/lib development dependency is updated.
Scheduling behavior test updates
src/apps/main/token-scheduler/token-scheduler.test.ts
Scheduling tests now use hour-based offsets while retaining coverage for token selection, invalid tokens, and past renewal dates.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: alexismora

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main refactor: token scheduling now uses hours instead of days.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/change-token-scheduler-to-hours

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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