Mercurial > prosody-modules
comparison mod_pubsub_feeds/mod_pubsub_feeds.lua @ 1453:7b53cfc6ba8d
mod_pubsub_feeds: Fix refresh_feeds() allways refreshing all feeds
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 26 Jun 2014 18:25:18 +0200 |
| parents | 7dbde05b48a9 |
| children | 480c6f0576b1 |
comparison
equal
deleted
inserted
replaced
| 1452:097c6af98d0a | 1453:7b53cfc6ba8d |
|---|---|
| 138 item.last_update = time(); | 138 item.last_update = time(); |
| 139 end | 139 end |
| 140 end); | 140 end); |
| 141 end | 141 end |
| 142 | 142 |
| 143 function refresh_feeds(force) | 143 function refresh_feeds(now) |
| 144 local now = time(); | |
| 145 --module:log("debug", "Refreshing feeds"); | 144 --module:log("debug", "Refreshing feeds"); |
| 146 for node, item in pairs(feed_list) do | 145 for node, item in pairs(feed_list) do |
| 147 --FIXME Don't fetch feeds which have a subscription | 146 --FIXME Don't fetch feeds which have a subscription |
| 148 -- Otoho, what if the subscription expires or breaks? | 147 -- Otoho, what if the subscription expires or breaks? |
| 149 if force or item.last_update + refresh_interval < now then | 148 if item.subscription ~= "subscribe" and item.last_update + refresh_interval < now then |
| 150 --module:log("debug", "checking %s", item.node); | 149 --module:log("debug", "checking %s", item.node); |
| 151 fetch(item, update_entry); | 150 fetch(item, update_entry); |
| 152 end | 151 end |
| 153 end | 152 end |
| 154 return refresh_interval; | 153 return refresh_interval; |
