From b593dcf992727377feec931c0cfc5534520f6bfa Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 8 Apr 2007 16:41:01 +0000 Subject: rss plugin: don't flood watcher with current rss content when a watch is added --- data/rbot/plugins/rss.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'data/rbot/plugins') diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index a067cbba..8b132ba6 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -641,16 +641,18 @@ class RSSFeedsPlugin < Plugin end status = Hash.new status[:failures] = 0 + status[:first_run] = true @watch[feed.handle] = @bot.timer.add(0, status) { debug "watcher for #{feed} started" failures = status[:failures] + first_run = status.delete(:first_run) begin debug "fetching #{feed}" oldxml = feed.xml ? feed.xml.dup : nil unless fetchRss(feed) failures += 1 else - if oldxml and oldxml == feed.xml + if first_run or (oldxml and oldxml == feed.xml) debug "xml for #{feed} didn't change" failures -= 1 if failures > 0 else -- cgit v1.2.3