Use strings for URLs internally for consistency.
This commit is contained in:
+7
-8
@@ -11,7 +11,6 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -90,12 +89,12 @@ func GofeedConvert(f *gofeed.Feed, title string) (*Feed, error) {
|
||||
}
|
||||
|
||||
// InsertFeed will insert or update a core.Feed in a core.FullData
|
||||
func (d *FullData) InsertFeed(new *Feed, remote *url.URL) {
|
||||
func (d *FullData) InsertFeed(new *Feed, remote string) {
|
||||
d.FeedsMu.Lock()
|
||||
oldFeed, ok := d.Feeds[remote.String()]
|
||||
oldFeed, ok := d.Feeds[remote]
|
||||
if !ok || !reflect.DeepEqual(new, oldFeed) {
|
||||
// Feeds are different, or there was never an old one
|
||||
d.Feeds[remote.String()] = new
|
||||
d.Feeds[remote] = new
|
||||
d.FeedsMu.Unlock()
|
||||
} else {
|
||||
d.FeedsMu.Unlock()
|
||||
@@ -103,12 +102,12 @@ func (d *FullData) InsertFeed(new *Feed, remote *url.URL) {
|
||||
}
|
||||
|
||||
// InsertPage will insert or update a core.Page in a core.FullData
|
||||
func (d *FullData) InsertPage(new *Page, remote *url.URL) {
|
||||
func (d *FullData) InsertPage(new *Page, remote string) {
|
||||
d.PagesMu.Lock()
|
||||
_, ok := d.Pages[remote.String()]
|
||||
if !ok || d.Pages[remote.String()].Hash != new.Hash {
|
||||
_, ok := d.Pages[remote]
|
||||
if !ok || d.Pages[remote].Hash != new.Hash {
|
||||
// pages are different, or there was never an old one
|
||||
d.Pages[remote.String()] = new
|
||||
d.Pages[remote] = new
|
||||
d.PagesMu.Unlock()
|
||||
} else {
|
||||
d.PagesMu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user