Skip to content

Commit 8ee7c80

Browse files
committed
Set new request id when scheduling the next task. Fixes exception when the next script was queued.
1 parent 1eaa5b1 commit 8ee7c80

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

netbox_script_manager/scripts.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,14 @@ def _run_script():
283283
new_scheduled_time = script_execution.scheduled + timedelta(minutes=script_execution.interval)
284284
logger.info(f"Scheduling next job for {new_scheduled_time}")
285285

286+
# Generate a new request id
287+
new_request_id = uuid.uuid4()
288+
request.id = new_request_id
289+
286290
next_execution = ScriptExecution(
287291
script_instance=script_execution.script_instance,
288292
task_id=uuid.uuid4(),
289-
request_id=request.id,
293+
request_id=new_request_id,
290294
user=request.user,
291295
status=ScriptExecutionStatusChoices.STATUS_SCHEDULED,
292296
scheduled=new_scheduled_time,

0 commit comments

Comments
 (0)