mirror of
https://github.com/0x2E/fusion.git
synced 2025-06-08 05:27:15 +09:00
Rename pull.FetchFeeds to FetchFeed
If I understand correctly, the function fetches a single feed, so the name should be FetchFeed to reflect the function's purpose.
This commit is contained in:
parent
7f33caf701
commit
235e93b0fd
2 changed files with 3 additions and 3 deletions
|
@ -121,7 +121,7 @@ func (f Feed) Create(ctx context.Context, req *ReqFeedCreate) error {
|
||||||
func (f Feed) CheckValidity(ctx context.Context, req *ReqFeedCheckValidity) (*RespFeedCheckValidity, error) {
|
func (f Feed) CheckValidity(ctx context.Context, req *ReqFeedCheckValidity) (*RespFeedCheckValidity, error) {
|
||||||
link := req.Link
|
link := req.Link
|
||||||
validLinks := make([]ValidityItem, 0)
|
validLinks := make([]ValidityItem, 0)
|
||||||
parsed, err := pull.FetchFeeds(ctx, &model.Feed{Link: &link})
|
parsed, err := pull.FetchFeed(ctx, &model.Feed{Link: &link})
|
||||||
if err == nil && parsed != nil {
|
if err == nil && parsed != nil {
|
||||||
validLinks = append(validLinks, ValidityItem{
|
validLinks = append(validLinks, ValidityItem{
|
||||||
Title: &parsed.Title,
|
Title: &parsed.Title,
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (p *Puller) do(ctx context.Context, f *model.Feed, force bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
failure := ""
|
failure := ""
|
||||||
fetched, err := FetchFeeds(ctx, f)
|
fetched, err := FetchFeed(ctx, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
failure = err.Error()
|
failure = err.Error()
|
||||||
p.feedRepo.Update(f.ID, &model.Feed{Failure: &failure})
|
p.feedRepo.Update(f.ID, &model.Feed{Failure: &failure})
|
||||||
|
@ -77,7 +77,7 @@ func (p *Puller) do(ctx context.Context, f *model.Feed, force bool) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func FetchFeeds(ctx context.Context, f *model.Feed) (*gofeed.Feed, error) {
|
func FetchFeed(ctx context.Context, f *model.Feed) (*gofeed.Feed, error) {
|
||||||
resp, err := httpx.FusionRequest(ctx, *f.Link, &f.FeedRequestOptions)
|
resp, err := httpx.FusionRequest(ctx, *f.Link, &f.FeedRequestOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue