3rd-party-integrations / github-team-sync

Sync GitHub teams to groups in Active Directory, LDAP, Okta, OneLogin or AzureAD when using any authentication method for GitHub.
MIT License
201 stars 67 forks source link

Step value for SYNC_SCHEDULE #102

Closed jschanfung closed 2 years ago

jschanfung commented 3 years ago

Checking to see if SYNC_SCHEDULE can be set more frequently and how often would it accept

Current default 0 * * * *. So something like */5 * * * * would be acceptable or not? I suppose we should avoid getting it too frequent so love to hear any kind of threshold would imply here.

Chocrates commented 3 years ago

SYNC_SCHEDULE is fed directly into the scheduler here https://github.com/github/github-team-sync/blob/main/app.py#L272 It looks like it can take arbitrary cron syntax, so yes you could make it run more frequently.

However if you run it too frequently you run the risk of it not completing the job before the next one starts. I don't know what this will do, whether or not it will finish the old one while the new one starts.

primetheus commented 2 years ago

Yes, this is standard cron syntax, but ideally you should have your app responding to webhooks, so a scheduled sync should only be scheduled to catch the missed webhooks. I would recommend a less frequent schedule, especially with larger directories, since the schedule will synchronize the entire directory that is configured.

As far as running every 5 minutes goes, if you have a larger directory it won't finish before the next one starts, which will create failures in each subsequent run. Ultimately it's likely it will hit resource constraints because of excessive polling.