summaryrefslogtreecommitdiff
path: root/internal/ui/table.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-22 09:21:06 +0300
committerPaul Buetow <paul@buetow.org>2026-06-22 09:21:06 +0300
commit1888b70cf4981cabaef0b6e33e0ae9982d3a788e (patch)
tree5cec4e67a05547b61ed03ffe7709902a80da3c35 /internal/ui/table.go
parent02f5f1419c4cb5fccc47a0ce4dbf3957e73b0e79 (diff)
fix task export timeout for lq0
Diffstat (limited to 'internal/ui/table.go')
-rw-r--r--internal/ui/table.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index 14b5c52..9aeeda1 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -1,6 +1,7 @@
package ui
import (
+ "context"
"fmt"
"os"
"os/exec"
@@ -24,6 +25,8 @@ import (
var priorityOptions = []string{"H", "M", "L", ""}
+const taskExportTimeout = 30 * time.Second
+
var (
urlRegex = regexp.MustCompile(`https?://\S+`)
searchRegexCache = make(map[string]*regexp.Regexp, 16)
@@ -259,6 +262,10 @@ type reloadData struct {
ultraFilterIDs []int
}
+func taskExportContext() (context.Context, context.CancelFunc) {
+ return context.WithTimeout(context.Background(), taskExportTimeout)
+}
+
// blinkInterval controls how quickly the row flashes when a task changes.
// A shorter interval results in a faster blink.
const blinkInterval = 150 * time.Millisecond
@@ -484,7 +491,10 @@ func (m *Model) fetchTasks() (reloadData, error) {
// Always show only pending tasks by default.
filters := append([]string(nil), m.filters...)
filters = append(filters, "status:pending")
- tasks, err := task.Export(filters...)
+ ctx, cancel := taskExportContext()
+ defer cancel()
+
+ tasks, err := task.Export(ctx, filters...)
if err != nil {
return reloadData{}, err
}