summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Nussbaum <lucas@lucas-nussbaum.net>2008-12-03 11:02:25 +0100
committerLucas Nussbaum <lucas@lucas-nussbaum.net>2008-12-03 11:02:25 +0100
commit95264d407d63066c63a225ae2b33cfc1249f2685 (patch)
treec5b6c1ddf5e83b01de0687c6962c2c19956c35c6
parent110512f983b298a160f3424ff7a409b2096e59db (diff)
downloadfeed2imap-95264d407d63066c63a225ae2b33cfc1249f2685.tar.gz
feed2imap-95264d407d63066c63a225ae2b33cfc1249f2685.tar.bz2
feed2imap-95264d407d63066c63a225ae2b33cfc1249f2685.zip
warn if feed takes too much time to be fetched
-rw-r--r--ChangeLog6
-rw-r--r--lib/feed2imap/feed2imap.rb5
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3185cdd..e79c54d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Feed2Imap 0.9.4 (23/07/2008)
+============================
+* Warn (INFO level, so only displayed with feed2imap -v) if fetching a
+ feed takes more than 10s, as this might cause massive delays
+ in feed2imap run times.
+
Feed2Imap 0.9.3 (23/07/2008)
============================
* Check the return code from external commands, and warn if != 0. Fixes
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb
index f6c64bc..3627ab0 100644
--- a/lib/feed2imap/feed2imap.rb
+++ b/lib/feed2imap/feed2imap.rb
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Feed2Imap version
F2I_VERSION = '0.9.3'
+F2I_WARNFETCHTIME = 10
require 'feed2imap/config'
require 'feed2imap/cache'
@@ -118,6 +119,7 @@ class Feed2Imap
end
sparefetchers -= 1
end
+ fetch_start = Time::now
if feed.url
s = HTTPFetcher::fetch(feed.url, @cache.get_last_check(feed.name))
elsif feed.execurl
@@ -148,6 +150,9 @@ class Feed2Imap
end
mutex.unlock
end
+ if Time::now - fetch_start > F2I_WARNFETCHTIME
+ @logger.info("Fetching feed #{feed.name} took #{(Time::now - fetch_start).to_i}s")
+ end
sparefetchers_mutex.synchronize do
sparefetchers += 1
sparefetchers_cond.signal