Skip to content

Commit c030c0e

Browse files
fix time var
1 parent c5bb3c1 commit c030c0e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

service_monitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
PROJECT = os.environ.get('PROJECT')
2323

2424
# Store the last trigger time for each service
25-
_last_trigger_time = 0
25+
global last_trigger_global = 0
2626
DEBOUNCE_INTERVAL = 180 # 3 minutes in seconds
2727

2828
def trigger_github_workflow(gh_token: str, event_type: str, service_key: str) -> bool:
@@ -46,7 +46,7 @@ def trigger_github_workflow(gh_token: str, event_type: str, service_key: str) ->
4646
return False
4747

4848
current_time = time.time()
49-
last_trigger_time = _last_trigger_time
49+
last_trigger_time = last_trigger_global
5050

5151
# Check if enough time has passed since the last trigger
5252
if current_time - last_trigger_time < DEBOUNCE_INTERVAL:
@@ -91,7 +91,7 @@ def trigger_github_workflow(gh_token: str, event_type: str, service_key: str) ->
9191
inputs=inputs
9292
)
9393
# Update the last trigger time only on successful dispatch
94-
_last_trigger_time = current_time
94+
last_trigger_global = current_time
9595
logger.info(f"Successfully triggered workflow {workflow.path} for event: {event_type} (service: {service_key})")
9696
return True
9797

0 commit comments

Comments
 (0)