Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def sync_dbs():
# prevent multiple workers on the same box from
# synching the directory at the same time
lock_path = os.path.join(os.environ['DATA_DB_PATH'], 'tmp/db.lock')
ensure_dir(lock_path)
try:
with FileLock(lock_path, wait=False):
download_dbs()
except FileLockException:
logger.warn("Lockfile %s exists skiping sync",lock_path)