aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/server/unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/server/unix.go')
-rw-r--r--pkg/server/unix.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/server/unix.go b/pkg/server/unix.go
index a46320d..9d8c266 100644
--- a/pkg/server/unix.go
+++ b/pkg/server/unix.go
@@ -6,6 +6,7 @@ import (
"log/slog"
"net"
"sync"
+ "time"
"github.com/jpappel/atlas/pkg/data"
"github.com/jpappel/atlas/pkg/index"
@@ -128,15 +129,18 @@ func (s *UnixServer) handleConn(conn *net.UnixConn, id uint64) {
break
}
- docs, err := s.Db.Execute(artifact)
+ ctx, cancel := context.WithTimeout(context.Background(), 400*time.Millisecond)
+ docs, err := s.Db.Execute(ctx, artifact)
if err != nil {
slog.Warn("Failed to execute query",
slog.String("query", queryTxt),
slog.String("err", err.Error()),
)
s.writeError(conn, "query execution error")
+ cancel()
break
}
+ cancel()
slog.Debug("Sending results")
s.writeResults(conn, docs)