comparison mod_pubsub_feeds/mod_pubsub_feeds.lua @ 2423:1b6027ef5191

mod_pubsub_feeds: Load config option once
author Kim Alvefur <zash@zash.se>
date Mon, 19 Dec 2016 07:49:40 +0100
parents 57235bce06fc
children cae371544ff5
comparison
equal deleted inserted replaced
2422:57235bce06fc 2423:1b6027ef5191
44 local http = require "net.http"; 44 local http = require "net.http";
45 local formdecode = http.formdecode; 45 local formdecode = http.formdecode;
46 local formencode = http.formencode; 46 local formencode = http.formencode;
47 47
48 local feed_list = module:shared("feed_list"); 48 local feed_list = module:shared("feed_list");
49 local refresh_interval; 49 local refresh_interval = module:get_option_number("feed_pull_interval", 15) * 60;
50 local lease_length = tostring(math.floor(module:get_option_number("feed_lease_length", 86400))); 50 local lease_length = tostring(math.floor(module:get_option_number("feed_lease_length", 86400)));
51 51
52 function module.load() 52 function module.load()
53 local config = module:get_option("feeds", { }); 53 local config = module:get_option("feeds", { });
54 refresh_interval = module:get_option_number("feed_pull_interval", 15) * 60;
55 local ok, nodes = pubsub.service:get_nodes(true); 54 local ok, nodes = pubsub.service:get_nodes(true);
56 if not ok then nodes = {}; end 55 if not ok then nodes = {}; end
57 local new_feed_list = {}; 56 local new_feed_list = {};
58 for node, url in pairs(config) do 57 for node, url in pairs(config) do
59 if type(node) == "number" then 58 if type(node) == "number" then