Skip to content

Commit 33a1855

Browse files
committed
Add 20ms timeout for firewall lists
1 parent 6c673ad commit 33a1855

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

aikido_zen/background_process/comms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ def __init__(self, address, key):
4444
global comms
4545
comms = self
4646

47-
def send_data_to_bg_process(self, action, obj, receive=False):
47+
def send_data_to_bg_process(self, action, obj, receive=False, timeout_in_sec=0.1):
4848
"""Try-catched send_data_to_bg_process"""
4949
try:
50-
return self._send_data_to_bg_process(action, obj, receive)
50+
return self._send_data_to_bg_process(action, obj, receive, timeout_in_sec)
5151
except Exception as e:
5252
logger.debug("Exception happened in send_data_to_bg_process : %s", e)
5353
return {"success": False, "error": "unknown"}
5454

55-
def _send_data_to_bg_process(self, action, obj, receive=False):
55+
def _send_data_to_bg_process(self, action, obj, receive=False, timeout_in_sec=0.1):
5656
"""
5757
This creates a new client for comms to the background process
5858
"""
@@ -88,7 +88,7 @@ def target(address, key, receive, data, result_obj):
8888

8989
# Start and join the thread for 100ms, afterwards the thread is forced to close (daemon=True)
9090
t.start()
91-
t.join(timeout=0.1)
91+
t.join(timeout=timeout_in_sec)
9292
if not result_obj[0]:
9393
logger.debug(
9494
" Failure in communication to background process, %s(%s)", action, obj

aikido_zen/sources/functions/request_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def pre_response():
5858
"user-agent": context.get_user_agent(),
5959
},
6060
receive=True,
61+
timeout_in_sec=(20 / 1000),
6162
)
6263
if not check_fw_lists_res["success"] or not check_fw_lists_res["data"]["blocked"]:
6364
return

0 commit comments

Comments
 (0)