Skip to content

fixed cron job bug#12

Merged
Remi561 merged 1 commit into
mainfrom
features/connected-to-frontend
Jun 26, 2026
Merged

fixed cron job bug#12
Remi561 merged 1 commit into
mainfrom
features/connected-to-frontend

Conversation

@Remi561

@Remi561 Remi561 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the jobs endpoint routing so scheduled maintenance actions now use the correct path and handler.
    • Improved cron request validation and server import handling for more reliable execution.
    • Prevented a background job from running automatically on load, reducing unexpected side effects.
  • New Features

    • Added a maintenance endpoint that runs the current background jobs and returns their results.
  • Style

    • Updated dashboard chart labels and colors for a clearer visual display.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subly Ready Ready Preview, Comment Jun 26, 2026 2:35pm

@Remi561 Remi561 merged commit 941f49d into main Jun 26, 2026
2 checks passed
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d8d03efc-7f89-4c7b-a76c-d1b1cdaa4cd0

📥 Commits

Reviewing files that changed from the base of the PR and between 2134d96 and d0a586a.

📒 Files selected for processing (8)
  • client/src/components/dashboard/Chart.jsx
  • server/server.js
  • server/src/controllers/maintainance.controller.js
  • server/src/controllers/maintenance.controller.js
  • server/src/jobs/sendExpired.js
  • server/src/middlewares/verifyCronSecret.middleware.js
  • server/src/routes/maintainance.route.js
  • server/src/routes/maintenance.route.js

📝 Walkthrough

Walkthrough

Dashboard chart styling changes and a new maintenance endpoint were added. The maintenance handler now runs three jobs after cron-secret verification, and sendExpired no longer executes on module load.

Changes

Dashboard chart styling

Layer / File(s) Summary
Chart labels and colors
client/src/components/dashboard/Chart.jsx
chartConfig updates the AI_TOOLS and STORAGE entries with new labels and CSS color variables.

Maintenance jobs flow

Layer / File(s) Summary
Maintenance handler and jobs
server/src/controllers/maintenance.controller.js, server/src/jobs/sendExpired.js
jobsMaintenance imports syncRate, sendReminder, and sendExpired, runs them with Promise.allSettled, and returns the settled results; sendExpired no longer runs or disconnects on module load.
Route and server wiring
server/src/routes/maintenance.route.js, server/server.js, server/src/middlewares/verifyCronSecret.middleware.js
The new router registers POST /maintenance with verifyCronSecret, server.js mounts jobsMaintenanceRouter on /api/jobs, and verifyCronSecret imports ../config/env.js.

Sequence Diagram(s)

sequenceDiagram
  participant jobsMaintenanceRouter
  participant verifyCronSecret
  participant jobsMaintenance
  participant syncRate
  participant sendReminder
  participant sendExpired
  jobsMaintenanceRouter->>verifyCronSecret: POST /maintenance
  verifyCronSecret-->>jobsMaintenanceRouter: allow request
  jobsMaintenanceRouter->>jobsMaintenance: invoke handler
  par maintenance jobs
    jobsMaintenance->>syncRate: run
    jobsMaintenance->>sendReminder: run
    jobsMaintenance->>sendExpired: run
  end
  jobsMaintenance-->>jobsMaintenanceRouter: JSON response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Remi561/Subly#8: Changes the same server/src/jobs/sendExpired.js flow, including immediate execution and Prisma disconnect behavior.
  • Remi561/Subly#9: Also works on the maintenance cron path, including the maintenance endpoint/controller naming and cron-job wiring.

Poem

A bunny hopped by with a chartful grin,
"Ai Tools" and storage got a fresh new spin.
Three jobs went thump in one neat row,
Then off I bounced with a secret-cron glow. 🐰

✨ 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 features/connected-to-frontend

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