Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Check for scheduled or processing jobs when scheduling permission syncs#61024

Merged
pjlast merged 5 commits into
mainfrom
pjlast/61023-fix-double-perms-scheduling
Mar 12, 2024
Merged

Check for scheduled or processing jobs when scheduling permission syncs#61024
pjlast merged 5 commits into
mainfrom
pjlast/61023-fix-double-perms-scheduling

Conversation

@pjlast

@pjlast pjlast commented Mar 12, 2024

Copy link
Copy Markdown
Contributor

Closes #61023

Fixes an issue where multiple permission sync jobs are scheduled for users and repositories at the same time.

The existing SQL queries don't take into account that a permissions sync could be in progress or queued when checking for users/repos with the oldest permissions, which leads to a lot of overlapping permission syncs being scheduled. This could cause significant delays in the permissions sync system as a whole, since a single permissions sync now turns into 5+ consecutive syncs for the same user.

Test plan

Verified on my local machine that multiple permission jobs are no longer scheduled for the same user/repo.

@cla-bot cla-bot Bot added the cla-signed label Mar 12, 2024
@pjlast pjlast requested a review from a team March 12, 2024 10:55
@github-actions github-actions Bot added the team/source Tickets under the purview of Source - the one Source to graph it all label Mar 12, 2024

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change LGTM, but can we get a test to prove this behavior?

@pjlast pjlast merged commit 810289a into main Mar 12, 2024
@pjlast pjlast deleted the pjlast/61023-fix-double-perms-scheduling branch March 12, 2024 13:04
sourcegraph-release-bot pushed a commit that referenced this pull request Mar 18, 2024
BolajiOlajide pushed a commit that referenced this pull request Mar 18, 2024
… permission syncs (#61212)

* Check for scheduled or processing jobs when scheduling permission syncs (#61024)

(cherry picked from commit 810289a)

* Remove changelog entries

---------

Co-authored-by: Petri-Johan Last <petri.last@sourcegraph.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport 5.3 cla-signed team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission sync jobs are being scheduled even when a sync has already been scheduled or is in progress.

2 participants