Skip to content

added more crons#150

Merged
breadddevv merged 1 commit into
mainfrom
feature/crons
Jun 9, 2026
Merged

added more crons#150
breadddevv merged 1 commit into
mainfrom
feature/crons

Conversation

@breadddevv

@breadddevv breadddevv commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Chores
    • Added automated cleanup of expired authentication sessions, OAuth states, and pending verifications running at scheduled intervals to maintain data hygiene and system performance.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces automated cleanup of expired authentication-related records. It adds three new cron utilities to delete stale auth sessions, OAuth state, and pending verifications on recurring schedules, reorders a schema field, and wires these jobs into the cron initialization system.

Changes

Scheduled Expiration Cleanup for Auth Entities

Layer / File(s) Summary
Expiration cleanup implementations
prisma/schema.prisma, utils/crons/authSessions.ts, utils/crons/authState.ts, utils/crons/pVerification.ts
AuthSession model field reordering places expiresAt after updatedAt. Three new cron utility modules each export an async function that bulk-deletes expired records via Prisma (where expiresAt <= now()) and returns { success: true, deleted: count }.
Cron job registration
utils/cronJobs.ts
Imports the three cleanup utilities and schedules them: auth-session cleanup every 30 minutes, and OAuth and pending-verification cleanups every 5 minutes, each with try/catch error handling and distinct [CRON][AUTH] / [CRON][OAUTH] log prefixes.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops through the database with cleanup delight,
Sweeping expired tokens out of sight,
Auth sessions, OAuth states, verifications too—
Every thirty minutes, the cron jobs renew! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'added more crons' is vague and generic, lacking specificity about which cron jobs were added or their purpose. Improve the title to be more specific, such as 'Add session cleanup, OAuth state, and pending verification cron jobs' to clearly convey what was added and why.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/crons

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 and usage tips.

@breadddevv breadddevv merged commit 101e865 into main Jun 9, 2026
4 of 5 checks passed
@breadddevv breadddevv deleted the feature/crons branch June 9, 2026 08:34
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