-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
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.
There was a problem hiding this 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.
readthedocs/oauth/tasks.py
Outdated
members.count(), | ||
) | ||
for user in members: | ||
sync_remote_repositories.delay(user.pk) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Created a Celery scheduled task to be called every day and re-sync all the
RemoteRepository
andRemoteRepositoryRelation
for all the users belonging toan organization with AllAuth SSO enabled.