Add cancellation reason tracking with user/system codes and UI

This commit is contained in:
2026-07-08 17:31:22 -04:00
parent 3c1bbce9e7
commit 69c4898a56
9 changed files with 137 additions and 32 deletions
+12 -3
View File
@@ -13,8 +13,9 @@ type Queue struct {
}
type RunInfo struct {
JobID int64
Cancel func()
JobID int64
Cancel func()
ByUser bool
}
func NewQueue() *Queue {
@@ -54,10 +55,18 @@ func (q *Queue) GetJobID(syncPairID int64) (int64, bool) {
return info.JobID, true
}
func (q *Queue) Cancel(syncPairID int64) {
func (q *Queue) Cancel(syncPairID int64, byUser bool) {
q.mu.Lock()
defer q.mu.Unlock()
if info, exists := q.runs[syncPairID]; exists && info.Cancel != nil {
info.ByUser = byUser
info.Cancel()
}
}
func (q *Queue) IsCancelledByUser(syncPairID int64) bool {
q.mu.Lock()
defer q.mu.Unlock()
info, exists := q.runs[syncPairID]
return exists && info.ByUser
}