calendar sync: nightly sync forces updates and skips the per-user lock
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start with app/jobs/nightly_calendar_sync_job.rb and config/recurring.yml, then read app/jobs/google_calendar_sync_job.rb and its specs. Check how the nightly job selects users and how the sync job accepts force; add a spec asserting one sync job is enqueued per user. Done when the nightly job delegates each user sync without forcing unchanged events.
Written by the indexing model from the issue text.
Description
Found in the #654 audit.
Problem
app/jobs/nightly_calendar_sync_job.rb runs every 6 hours (config/recurring.yml).
- Users with
calendar_needs_sync = truesync withforce: true(line 22). InGoogleCalendarService(if force || existing_event.data_changed?, about line 115),forcesends anupdate_eventcall for every event, also for events that did not change. One course title change during registration can send 20 to 50 Google API calls for each enrolled user. - The job syncs all users inline, one after the other, in one worker thread. It does not use
GoogleCalendarSyncJob, so it does not uselimits_concurrency(google_calendar_sync_job.rb:6). A nightly sync and a user sync for the same user can run at the same time and make duplicate events.
Fix
- Enqueue
GoogleCalendarSyncJob.perform_later(user, force: false)for each user.data_changed?already skips events that did not change. - If
forceis necessary for a case, write down which case and keep it for that case only. - Add a spec that the job enqueues one sync job for each user.
Effort: small to medium.
- Dominant language
- Ruby
- Stars
- 4
- Forks
- 0
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 181
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WITCodingClub/calendar-backend
-
Difficulty 1/5 Under an hour Newbie friendliness 67/100
WITCodingClub/calendar-backend#908 ·
Maintainers usually reply within 1 day
-
performance v/6
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
WITCodingClub/calendar-backend#687 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WITCodingClub/calendar-backend#868 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
WITCodingClub/calendar-backend#867 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
WITCodingClub/calendar-backend#865 ·
Maintainers usually reply within 1 day
All issues in WITCodingClub/calendar-backend
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
palladius/rails8-app-on-gcp#198 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 95/100
WikiEducationFoundation/WikiEduDashboard#7258 ·
Maintainers usually reply within 1 day
-
UX/UI verified
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 5 days
-
Invalid UTF-8 in `MCP-Protocol-Version`, `Mcp-Method` or `Mcp-Name` gives 500 instead of 400Possibly taken @atesgoral claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/ruby-sdk#663 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day