Exemple #1
0
func PollFeed(uri string, timeout int) {

	handlers := &MyHandlers{}
	feed := rss.NewWithHandlers(timeout, true, handlers, handlers)

	for {
		if err := feed.Fetch(uri, nil); err != nil {
			fmt.Fprintf(os.Stderr, "[e] %s: %s", uri, err)
			return
		}

		<-time.After(time.Duration(10 * time.Second))
	}
}
func newFeedGetter(feed *domain.Feed) *feedGetter {
	getter := new(feedGetter)
	getter.feed = feed
	getter.feedConnector = rss.NewWithHandlers(5, true, getter, getter)
	return getter
}