Skip to content

SSO: re-sync VCS accounts for SSO organization daily #8601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 21, 2021

Conversation

humitos
Copy link
Member

@humitos humitos commented Oct 19, 2021

Created a Celery scheduled task to be called every day and re-sync all the
RemoteRepository and RemoteRepositoryRelation for all the users belonging to
an organization with AllAuth SSO enabled.

Created a Celery scheduled task to be called every day and re-sync all the
`RemoteRepository` and `RemoteRepositoryRelation` for all the users belonging to
an organization with AllAuth SSO enabled.
@humitos humitos requested a review from a team October 19, 2021 10:05
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

Looks like a simple approach for now, and we'll see if it helps keep things synced.

members.count(),
)
for user in members:
sync_remote_repositories.delay(user.pk)
Copy link
Member

Choose a reason for hiding this comment

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

Seems this might back up the queue a good bit. I don't know a good way to avoid it, but might make sense to delay this a little bit in the task or something? (eg. sleep 1 second between organizations or something?) Though even that will probably totally overwhelm the queue. I wish we had a good way to do a low priority task via celery.

Copy link
Member Author

@humitos humitos Oct 20, 2021

Choose a reason for hiding this comment

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

We can delay the execution of the task by passing countdown=seconds (https://docs.celeryproject.org/en/stable/userguide/calling.html#eta-and-countdown). So, we can trigger all the task with seconds being 0, 30, 60, 90... or similar. Does this make sense to you?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, we can try it if that works. Perhaps split them up by 5 seconds or something? But I'm not sure if that will overload the queue (or if our monitoring will take it into account), so not sure the best solution.

@humitos humitos enabled auto-merge October 21, 2021 09:03
@humitos humitos disabled auto-merge October 21, 2021 12:06
@humitos humitos enabled auto-merge October 21, 2021 12:07
@humitos humitos merged commit fb99da9 into master Oct 21, 2021
@humitos humitos deleted the humitos/resync-sso-daily branch October 21, 2021 12:15
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.

2 participants