Skip to content

Commit ae5cc0f

Browse files
committed
makes controller fail more gracefully when the db is closing
1 parent 337cc12 commit ae5cc0f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/server/ingest.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ func (ctrl *Controller) ingestHandler(w http.ResponseWriter, r *http.Request) {
7373
var err error
7474
t, err = tree.DeserializeNoDict(r.Body)
7575
if err != nil {
76-
log.Fatal(err)
76+
log.Error(err)
77+
return
7778
}
7879
} else {
7980
parserFunc := convert.ParseIndividualLines
@@ -94,7 +95,8 @@ func (ctrl *Controller) ingestHandler(w http.ResponseWriter, r *http.Request) {
9495

9596
err := ctrl.s.Put(ip.from, ip.until, ip.storageKey, t, ip.spyName, ip.sampleRate)
9697
if err != nil {
97-
log.Fatal(err)
98+
log.Error(err)
99+
return
98100
}
99101
ctrl.statsInc("ingest")
100102
ctrl.statsInc("ingest:" + ip.spyName)

0 commit comments

Comments
 (0)