Exemple #1
0
func (fm *FeedManager) stopUpdatingFeed(f content.Feed) {
	if f == nil {
		fm.logger.Infoln("No feed provided")
		return
	}

	data := f.Data()

	fm.logger.Infoln("Stopping feed update for " + data.Link)
	delete(fm.activeFeeds, data.Id)

	users := f.Users()
	if f.HasErr() {
		fm.logger.Printf("Error getting users for feed '%s': %v\n", f, f.Err())
	} else {
		if len(users) == 0 {
			fm.logger.Infoln("Removing orphan feed " + f.String() + " from the database")

			for _, m := range fm.feedMonitors {
				if err := m.FeedDeleted(f); err != nil {
					fm.logger.Printf(
						"Error invoking monitor '%s' on deleted feed '%s': %v\n",
						reflect.TypeOf(m), f, err)
				}
			}
			f.Delete()
			if f.HasErr() {
				fm.logger.Printf("Error deleting feed '%s' from the repository: %v\n", f, f.Err())
			}
		}
	}
}