Order stories by feed publish time, not ingest time
This commit is contained in:
@@ -188,7 +188,15 @@ func (p *Poller) pollOnceWithErr(ctx context.Context, src config.SourceConfig) e
|
||||
items[i].Source = src.Name
|
||||
items[i].DirectRoute = src.DirectRoute
|
||||
|
||||
// Store immediately (before routing) to prevent re-ingestion
|
||||
// Store immediately (before routing) to prevent re-ingestion.
|
||||
// Future-dated pubDates (publishers occasionally post-date drafts or
|
||||
// have a misconfigured clock) get clamped to ingest time so they don't
|
||||
// stick at the top of the queue indefinitely.
|
||||
seenAt := time.Now().Unix()
|
||||
publishedAt := items[i].PublishedAt
|
||||
if publishedAt > seenAt {
|
||||
publishedAt = seenAt
|
||||
}
|
||||
if err := storage.InsertStory(&storage.Story{
|
||||
GUID: items[i].GUID,
|
||||
Headline: items[i].Headline,
|
||||
@@ -199,7 +207,8 @@ func (p *Poller) pollOnceWithErr(ctx context.Context, src config.SourceConfig) e
|
||||
HeadlineNorm: headlineNorm,
|
||||
Source: items[i].Source,
|
||||
Paywalled: paywalled,
|
||||
SeenAt: time.Now().Unix(),
|
||||
SeenAt: seenAt,
|
||||
PublishedAt: publishedAt,
|
||||
}); err != nil {
|
||||
slog.Error("failed to insert story", "guid", items[i].GUID, "err", err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user