chore: fix queue sort, add feed temp

This commit is contained in:
xuu 2025-03-24 17:01:50 -06:00
parent 42a9b26b22
commit 8ae61d4a27
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
2 changed files with 6 additions and 4 deletions

View File

@ -153,10 +153,10 @@ func httpServer(c *console, app *appState) error {
http.HandleFunc("/queue", func(w http.ResponseWriter, r *http.Request) {
lis := slices.Collect(app.queue.Iter())
sort.Slice(lis, func(i, j int) bool {
return lis[i].LastScanOn.Time.Before(lis[j].LastScanOn.Time)
return lis[i].NextScanOn.Time.Before(lis[j].LastScanOn.Time)
})
for _, feed := range lis {
fmt.Fprintln(w, feed.State, feed.LastScanOn.Time.Format(time.RFC3339), feed.Nick, feed.URI)
fmt.Fprintln(w, feed.State, feed.NextScanOn.Time.Format(time.RFC3339), feed.Nick, feed.URI)
}
})

View File

@ -91,12 +91,14 @@ func feedRefreshProcessor(c *console, app *appState) error {
continue
}
span.AddEvent(
"till next",
trace.WithAttributes(attribute.String("time", until.String())))
sleeping_time.Add(ctx, until.Milliseconds())
select {
case <-ctx.Done():
return nil
case t := <-time.After(time.Until(f.NextScanOn.Time)):
case t := <-time.After(until):
span.AddEvent("fetch", trace.WithAttributes(
attribute.Int("size", int(queue.count)),
attribute.String("uri", f.URI),