Skip to content

Commit

Permalink
✨ do not parse historical stories
Browse files Browse the repository at this point in the history
  • Loading branch information
Law Zava committed Apr 18, 2020
1 parent 5c55a76 commit 7a90fd0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func newParser(cfg config) (*parser, error) {
}

func (p parser) run() error {
startedAt := time.Now() // used to prevent broadcasting historical stories

for {
for _, source := range p.sources {
feed, err := p.fp.ParseURL(source)
Expand All @@ -59,6 +61,10 @@ func (p parser) run() error {
}

for _, story := range feed.Items {
if story.Published < startedAt.String() {
continue
}

storyID := buildStoryID(story.Title, story.Link)

var storyWasSent bool
Expand Down

0 comments on commit 7a90fd0

Please # to comment.