chore: fix queue sort, add feed temp
This commit is contained in:
parent
42a9b26b22
commit
8ae61d4a27
4
http.go
4
http.go
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user