summaryrefslogtreecommitdiff
path: root/lib
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 /lib
parent110512f983b298a160f3424ff7a409b2096e59db (diff)
downloadfeed2imap-95264d407d63066c63a225ae2b33cfc1249f2685.tar.gz
feed2imap-95264d407d63066c63a225ae2b33cfc1249f2685.tar.bz2
feed2imap-95264d407d63066c63a225ae2b33cfc1249f2685.zip
warn if feed takes too much time to be fetched
Diffstat (limited to 'lib')
-rw-r--r--lib/feed2imap/feed2imap.rb5
1 files changed, 5 insertions, 0 deletions
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