Add feature flag for team syncing

This commit is contained in:
Joseph Schorr 2017-02-23 13:26:47 -05:00
parent 96b9d6b0cd
commit 04225f2d25
7 changed files with 21 additions and 10 deletions

View file

@ -1,6 +1,8 @@
import logging
import time
import features
from app import app, authentication
from data.users.teamsync import sync_teams_to_groups
from workers.worker import Worker
@ -8,8 +10,8 @@ from util.timedeltastring import convert_to_timedelta
logger = logging.getLogger(__name__)
WORKER_FREQUENCY = app.config.get('TEAM_SYNC_WORKER_FREQUENCY', 10)
STALE_CUTOFF = convert_to_timedelta(app.config.get('TEAM_RESYNC_STALE_TIME', '30s'))
WORKER_FREQUENCY = app.config.get('TEAM_SYNC_WORKER_FREQUENCY', 60)
STALE_CUTOFF = convert_to_timedelta(app.config.get('TEAM_RESYNC_STALE_TIME', '30m'))
class TeamSynchronizationWorker(Worker):
""" Worker which synchronizes teams with their backing groups in LDAP/Keystone/etc.
@ -25,8 +27,8 @@ class TeamSynchronizationWorker(Worker):
def main():
logging.config.fileConfig('conf/logging_debug.conf', disable_existing_loggers=False)
if not authentication.federated_service:
logger.debug('No federated auth is used; sleeping')
if not features.TEAM_SYNCING or not authentication.federated_service:
logger.debug('Team syncing is disabled; sleeping')
while True:
time.sleep(100000)