Miscellaneous improvements to internal/reader/subscription/finder.go
- Surface `localizedError` in FindSubscriptionsFromWellKnownURLs via slog - Use an inline declaration for new subscriptions, like done elsewhere in the file, if only for consistency's sake - Preallocate the `subscriptions` slice when using an RSS-bridge, it's a good practise, and it might even marginally improve performances when adding __a lot__ of feeds via an rss-bridge instance, wooo!
This commit is contained in:
parent
ecd59009fb
commit
5b2558bf92
1 changed files with 7 additions and 6 deletions
|
@ -235,14 +235,15 @@ func (f *SubscriptionFinder) FindSubscriptionsFromWellKnownURLs(websiteURL strin
|
||||||
defer responseHandler.Close()
|
defer responseHandler.Close()
|
||||||
|
|
||||||
if localizedError := responseHandler.LocalizedError(); localizedError != nil {
|
if localizedError := responseHandler.LocalizedError(); localizedError != nil {
|
||||||
|
slog.Debug("Unable to subscribe", slog.String("fullURL", fullURL), slog.Any("error", localizedError.Error()))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
subscription := new(Subscription)
|
subscriptions = append(subscriptions, &Subscription{
|
||||||
subscription.Type = kind
|
Type: kind,
|
||||||
subscription.Title = fullURL
|
Title: fullURL,
|
||||||
subscription.URL = fullURL
|
URL: fullURL,
|
||||||
subscriptions = append(subscriptions, subscription)
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +271,7 @@ func (f *SubscriptionFinder) FindSubscriptionsFromRSSBridge(websiteURL, rssBridg
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var subscriptions Subscriptions
|
subscriptions := make(Subscriptions, 0, len(bridges))
|
||||||
for _, bridge := range bridges {
|
for _, bridge := range bridges {
|
||||||
subscriptions = append(subscriptions, &Subscription{
|
subscriptions = append(subscriptions, &Subscription{
|
||||||
Title: bridge.BridgeMeta.Name,
|
Title: bridge.BridgeMeta.Name,
|
||||||
|
|
Loading…
Reference in a new issue