fix(queue-daemon): implement timeout handling for long-running tasks #228
@@ -50,7 +50,7 @@ check_task_completion() {
|
|||||||
local hours_elapsed=$(( (now_epoch - notified_epoch) / 3600 ))
|
local hours_elapsed=$(( (now_epoch - notified_epoch) / 3600 ))
|
||||||
if [ "$hours_elapsed" -ge "${TASK_TIMEOUT_HOURS:-1}" ]; then
|
if [ "$hours_elapsed" -ge "${TASK_TIMEOUT_HOURS:-1}" ]; then
|
||||||
timed_out=true
|
timed_out=true
|
||||||
echo "Task $queue_id ($issue_ref) timed out after ${hours_elapsed}h"
|
log_warn "queue-daemon" "Task $queue_id ($issue_ref) timed out after ${hours_elapsed}h"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ check_task_completion() {
|
|||||||
opencode session stop "$session_id" 2>/dev/null || true
|
opencode session stop "$session_id" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
update_queue_item_state "$queue_id" "error"
|
update_queue_item_state "$queue_id" "error"
|
||||||
echo "Task $queue_id ($issue_ref) marked error — timeout after ${hours_elapsed}h"
|
log_error "queue-daemon" "Task $queue_id ($issue_ref) marked error — timeout after ${hours_elapsed}h"
|
||||||
|
|
|||||||
release_lock "$issue_ref"
|
release_lock "$issue_ref"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user
for echo related stuff in this PR, I'd like to possibly use kugetsu-log rather than a raw echo so we can have a unified formatted log. what do you think?