mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
This fixes an issue where various parts of the system could get stuck
waiting to emit a socketio event if there was a problem with the websocket service. Instead of crashing and hanging the system it will now emit an error and continue.
This commit is contained in:
@@ -24,6 +24,7 @@ from django.utils.encoding import smart_str
|
||||
# PyCrypto
|
||||
from Crypto.Cipher import AES
|
||||
|
||||
logger = logging.getLogger('awx.main.utils')
|
||||
|
||||
__all__ = ['get_object_or_400', 'get_object_or_403', 'camelcase_to_underscore',
|
||||
'get_ansible_version', 'get_awx_version', 'update_scm_url',
|
||||
@@ -380,10 +381,13 @@ def get_system_task_capacity():
|
||||
def emit_websocket_notification(endpoint, event, payload):
|
||||
from awx.main.socket import Socket
|
||||
|
||||
with Socket('websocket', 'w') as websocket:
|
||||
payload['event'] = event
|
||||
payload['endpoint'] = endpoint
|
||||
websocket.publish(payload)
|
||||
try:
|
||||
with Socket('websocket', 'w', nowait=True, logger=logger) as websocket:
|
||||
payload['event'] = event
|
||||
payload['endpoint'] = endpoint
|
||||
websocket.publish(payload)
|
||||
except Exception as ex:
|
||||
pass
|
||||
|
||||
_inventory_updates = threading.local()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user