comparison mod_pubsub_feeds/mod_pubsub_feeds.lua @ 793:9fd30261b0e1

mod_pubsub_feeds: Add parameter refresh_feeds() to force refresh of all feeds
author Kim Alvefur <zash@zash.se>
date Wed, 15 Aug 2012 16:34:59 +0200
parents db27f07342d4
children 5a8fa70faa13
comparison
equal deleted inserted replaced
792:db27f07342d4 793:9fd30261b0e1
136 item.last_update = time(); 136 item.last_update = time();
137 end 137 end
138 end); 138 end);
139 end 139 end
140 140
141 function refresh_feeds() 141 function refresh_feeds(force)
142 local now = time(); 142 local now = time();
143 --module:log("debug", "Refreshing feeds"); 143 --module:log("debug", "Refreshing feeds");
144 for node, item in pairs(feed_list) do 144 for node, item in pairs(feed_list) do
145 --FIXME Don't fetch feeds which have a subscription 145 --FIXME Don't fetch feeds which have a subscription
146 -- Otoho, what if the subscription expires or breaks? 146 -- Otoho, what if the subscription expires or breaks?
147 if item.last_update + refresh_interval < now then 147 if force or item.last_update + refresh_interval < now then
148 --module:log("debug", "checking %s", item.node); 148 --module:log("debug", "checking %s", item.node);
149 fetch(item, update_entry); 149 fetch(item, update_entry);
150 end 150 end
151 end 151 end
152 return refresh_interval; 152 return refresh_interval;