mirror of
https://github.com/ansible/awx.git
synced 2026-07-10 15:58:05 -02:30
noop pglock for unit tests
This commit is contained in:
15
awx/main/utils/pglock.py
Normal file
15
awx/main/utils/pglock.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2017 Ansible by Red Hat
|
||||
# All Rights Reserved.
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
from django_pglocks import advisory_lock as django_pglocks_advisory_lock
|
||||
from django.db import connection
|
||||
|
||||
@contextmanager
|
||||
def advisory_lock(*args, **kwargs):
|
||||
if connection.vendor == 'postgresql':
|
||||
with django_pglocks_advisory_lock(*args, **kwargs) as internal_lock:
|
||||
yield internal_lock
|
||||
else:
|
||||
yield True
|
||||
Reference in New Issue
Block a user