diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2006-02-09 17:39:39 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2006-02-09 17:39:39 +0000 |
commit | c3cb06028dd0acf29ebd22fd5e1899442040540e (patch) | |
tree | 62d0d9aaf8d989b6ea14698da632e6e4d70ce388 /lib/feed2imap | |
parent | 23e3173f242db2e4a2867ae27ea4c3a22b085a8e (diff) | |
download | feed2imap-c3cb06028dd0acf29ebd22fd5e1899442040540e.tar.gz feed2imap-c3cb06028dd0acf29ebd22fd5e1899442040540e.tar.bz2 feed2imap-c3cb06028dd0acf29ebd22fd5e1899442040540e.zip |
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@82 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to 'lib/feed2imap')
-rw-r--r-- | lib/feed2imap/feed2imap.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb index c7d8a2a..41c75eb 100644 --- a/lib/feed2imap/feed2imap.rb +++ b/lib/feed2imap/feed2imap.rb @@ -102,34 +102,34 @@ class Feed2Imap ths = [] mutex = Mutex::new @config.feeds.each do |f| - ths << Thread::new(f) do + ths << Thread::new(f) do |feed| begin mutex.lock - lastcheck = @cache.get_last_check(f.name) - if f.needfetch(lastcheck) + lastcheck = @cache.get_last_check(feed.name) + if feed.needfetch(lastcheck) mutex.unlock - s = HTTPFetcher::fetch(f.url, @cache.get_last_check(f.name)) + s = HTTPFetcher::fetch(feed.url, @cache.get_last_check(feed.name)) mutex.lock - f.body = s - @cache.set_last_check(f.name, Time::now) + feed.body = s + @cache.set_last_check(feed.name, Time::now) end mutex.unlock # dump if requested if @config.dumpdir mutex.synchronize do - if f.body - fname = @config.dumpdir + '/' + f.name + '-' + Time::now.xmlschema - File::open(fname, 'w') { |file| file.puts f.body } + if feed.body + fname = @config.dumpdir + '/' + feed.name + '-' + Time::now.xmlschema + File::open(fname, 'w') { |file| file.puts feed.body } end end end rescue Timeout::Error mutex.synchronize do - @logger.fatal("Timeout::Error while fetching #{f.url}: #{$!}") + @logger.fatal("Timeout::Error while fetching #{feed.url}: #{$!}") end rescue mutex.synchronize do - @logger.fatal("Error while fetching #{f.url}: #{$!}") + @logger.fatal("Error while fetching #{feed.url}: #{$!}") end end end |