change http state storage
This commit is contained in:
parent
70761c47eb
commit
32ab1fefa9
3 changed files with 34 additions and 17 deletions
|
|
@ -258,7 +258,7 @@ func listItems(f storage.Feed, db *storage.Storage) ([]storage.Item, error) {
|
|||
var res *http.Response
|
||||
var err error
|
||||
|
||||
httpState := db.GetHTTPState(f.FeedLink)
|
||||
httpState := db.GetHTTPState(f.Id)
|
||||
if httpState != nil {
|
||||
res, err = defaultClient.getConditional(f.FeedLink, httpState.LastModified, httpState.Etag)
|
||||
} else {
|
||||
|
|
@ -282,7 +282,7 @@ func listItems(f storage.Feed, db *storage.Storage) ([]storage.Item, error) {
|
|||
lastModified := res.Header.Get("Last-Modified")
|
||||
etag := res.Header.Get("Etag")
|
||||
if lastModified != "" || etag != "" {
|
||||
db.SetHTTPState(f.FeedLink, storage.HTTPState{LastModified: lastModified, Etag: etag})
|
||||
db.SetHTTPState(f.Id, lastModified, etag)
|
||||
}
|
||||
|
||||
feedparser := gofeed.NewParser()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue