mirror of
https://github.com/0x2E/fusion.git
synced 2025-06-08 13:37:11 +09:00
Merge pull request #70 from mtlynch/simplify-failure
Get rid of failure variable in Puller.do
This commit is contained in:
commit
e5a53a1ea3
1 changed files with 3 additions and 4 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/0x2e/fusion/model"
|
"github.com/0x2e/fusion/model"
|
||||||
"github.com/0x2e/fusion/pkg/httpx"
|
"github.com/0x2e/fusion/pkg/httpx"
|
||||||
|
"github.com/0x2e/fusion/pkg/ptr"
|
||||||
|
|
||||||
"github.com/mmcdole/gofeed"
|
"github.com/mmcdole/gofeed"
|
||||||
)
|
)
|
||||||
|
@ -35,11 +36,9 @@ func (p *Puller) do(ctx context.Context, f *model.Feed, force bool) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failure := ""
|
|
||||||
fetched, err := FetchFeed(ctx, f)
|
fetched, err := FetchFeed(ctx, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
failure = err.Error()
|
p.feedRepo.Update(f.ID, &model.Feed{Failure: ptr.To(err.Error())})
|
||||||
p.feedRepo.Update(f.ID, &model.Feed{Failure: &failure})
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if fetched == nil {
|
if fetched == nil {
|
||||||
|
@ -76,7 +75,7 @@ func (p *Puller) do(ctx context.Context, f *model.Feed, force bool) error {
|
||||||
logger.Infof("fetched %d items", len(fetched.Items))
|
logger.Infof("fetched %d items", len(fetched.Items))
|
||||||
return p.feedRepo.Update(f.ID, &model.Feed{
|
return p.feedRepo.Update(f.ID, &model.Feed{
|
||||||
LastBuild: fetched.PublishedParsed,
|
LastBuild: fetched.PublishedParsed,
|
||||||
Failure: &failure,
|
Failure: ptr.To(""),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue