diff --git a/backend/app/rest/api/rest_public.go b/backend/app/rest/api/rest_public.go index 654c4765..a60e0bff 100644 --- a/backend/app/rest/api/rest_public.go +++ b/backend/app/rest/api/rest_public.go @@ -193,7 +193,6 @@ func (s *public) infoStreamCtrl(w http.ResponseWriter, r *http.Request) { if err != nil { return "info", data, false, err } - return "info", data, upd, nil } } @@ -264,11 +263,11 @@ func (s *public) lastCommentsStreamCtrl(w http.ResponseWriter, r *http.Request) if e != nil { return nil, e } + sinceTime = time.Now() if len(comments) > 0 { sinceTime = comments[0].Timestamp upd = true } - sinceTime = time.Now() return encodeJSONWithHTML(comments) }) return "last", data, upd, err diff --git a/backend/app/rest/api/rest_public_test.go b/backend/app/rest/api/rest_public_test.go index 27011443..b6894659 100644 --- a/backend/app/rest/api/rest_public_test.go +++ b/backend/app/rest/api/rest_public_test.go @@ -729,7 +729,7 @@ func TestRest_Robots(t *testing.T) { func TestRest_LastCommentsStream(t *testing.T) { ts, srv, teardown := startupT(t) srv.pubRest.readOnlyAge = 10000000 // make sure we don't hit read-only - srv.pubRest.streamer.Refresh = 10 * time.Millisecond + srv.pubRest.streamer.Refresh = 50 * time.Millisecond srv.pubRest.streamer.TimeOut = 500 * time.Millisecond srv.pubRest.streamer.MaxActive = 100 @@ -740,9 +740,10 @@ func TestRest_LastCommentsStream(t *testing.T) { go func() { defer close(done) for i := 1; i < 10; i++ { - time.Sleep(100 * time.Millisecond) postComment(t, ts.URL) + time.Sleep(100 * time.Millisecond) } + t.Log("wrote 10 records") }() client := http.Client{}