filter removes duplicates
This commit is contained in:
parent
30340200d3
commit
17001a1537
@ -110,11 +110,11 @@ func ParseConfig(configPath string) (*Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fu *FeedURL) UnmarshalYAML(node *yaml.Node) error {
|
func (fu *FeedURL) UnmarshalYAML(node *yaml.Node) error {
|
||||||
*fu = []string{""}
|
|
||||||
switch node.Kind {
|
switch node.Kind {
|
||||||
case yaml.SequenceNode:
|
case yaml.SequenceNode:
|
||||||
return node.Decode((*[]string)(fu))
|
return node.Decode((*[]string)(fu))
|
||||||
case yaml.ScalarNode:
|
case yaml.ScalarNode:
|
||||||
|
*fu = []string{""}
|
||||||
return node.Decode(&(*fu)[0])
|
return node.Decode(&(*fu)[0])
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unexpected node type: %s, at %d:%d", node.ShortTag(), node.Line, node.Column)
|
return fmt.Errorf("unexpected node type: %s, at %d:%d", node.ShortTag(), node.Line, node.Column)
|
||||||
|
@ -78,6 +78,7 @@ func (d *db) Filter(entries []parser.FeedEntry) ([]parser.FeedEntry, error) {
|
|||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if _, ok := d.seenLinks[entry.Link]; !ok {
|
if _, ok := d.seenLinks[entry.Link]; !ok {
|
||||||
filteredEntries = append(filteredEntries, entry)
|
filteredEntries = append(filteredEntries, entry)
|
||||||
|
d.seenLinks[entry.Link] = struct{}{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filteredEntries, nil
|
return filteredEntries, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user