Mercurial > prosody-modules
comparison mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua @ 6356:a115f6a68d33
mod_pubsub_serverinfo: Remove verbose debug log statements
Was probably useful during development of the module, but now it just causes
excessive log spam every refresh interval.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 14 Jan 2026 13:54:26 +0000 |
| parents | 25b091cbb471 |
| children | f24ff3e6e180 |
comparison
equal
deleted
inserted
replaced
| 6355:77d565a6df4e | 6356:a115f6a68d33 |
|---|---|
| 147 -- mapped to a collection of remote domain names. De-duplicate all remote domain names by using | 147 -- mapped to a collection of remote domain names. De-duplicate all remote domain names by using |
| 148 -- them as an index in a table. | 148 -- them as an index in a table. |
| 149 local domains_by_host = {} | 149 local domains_by_host = {} |
| 150 for session, _ in pairs(prosody.incoming_s2s) do | 150 for session, _ in pairs(prosody.incoming_s2s) do |
| 151 if session ~= nil and session.from_host ~= nil and local_domain == session.to_host then | 151 if session ~= nil and session.from_host ~= nil and local_domain == session.to_host then |
| 152 module:log("debug", "Local host '%s' has remote '%s' (inbound)", session.to_host, session.from_host); | |
| 153 local sessions = domains_by_host[session.to_host] | 152 local sessions = domains_by_host[session.to_host] |
| 154 if sessions == nil then sessions = {} end; -- instantiate a new entry if none existed | 153 if sessions == nil then sessions = {} end; -- instantiate a new entry if none existed |
| 155 sessions[session.from_host] = true | 154 sessions[session.from_host] = true |
| 156 domains_by_host[session.to_host] = sessions | 155 domains_by_host[session.to_host] = sessions |
| 157 end | 156 end |
| 168 local sessions = domains_by_host[host] | 167 local sessions = domains_by_host[host] |
| 169 if sessions == nil then sessions = {} end; -- instantiate a new entry if none existed | 168 if sessions == nil then sessions = {} end; -- instantiate a new entry if none existed |
| 170 if data.s2sout ~= nil then | 169 if data.s2sout ~= nil then |
| 171 for _, session in pairs(data.s2sout) do | 170 for _, session in pairs(data.s2sout) do |
| 172 if session.to_host ~= nil then | 171 if session.to_host ~= nil then |
| 173 module:log("debug", "Local host '%s' has remote '%s' (outbound)", host, session.to_host); | |
| 174 sessions[session.to_host] = true | 172 sessions[session.to_host] = true |
| 175 domains_by_host[host] = sessions | 173 domains_by_host[host] = sessions |
| 176 end | 174 end |
| 177 end | 175 end |
| 178 end | 176 end |
| 179 | 177 |
| 180 -- When the instance of Prosody hosts more than one host, the other hosts can be thought of as having a 'permanent' s2s connection. | 178 -- When the instance of Prosody hosts more than one host, the other hosts can be thought of as having a 'permanent' s2s connection. |
| 181 for host_name, host_info in pairs(prosody.hosts) do | 179 for host_name, host_info in pairs(prosody.hosts) do |
| 182 if host ~= host_name and host_info.type ~= "component" then | 180 if host ~= host_name and host_info.type ~= "component" then |
| 183 module:log("debug", "Local host '%s' has remote '%s' (vhost)", host, host_name); | |
| 184 sessions[host_name] = true; | 181 sessions[host_name] = true; |
| 185 domains_by_host[host] = sessions | 182 domains_by_host[host] = sessions |
| 186 end | 183 end |
| 187 end | 184 end |
| 188 end | 185 end |
| 299 | 296 |
| 300 -- try to read answer from cache. | 297 -- try to read answer from cache. |
| 301 local cached_value = opt_in_cache[remoteDomain] | 298 local cached_value = opt_in_cache[remoteDomain] |
| 302 local ttl = cached_value and os.difftime(cached_value.expires, os.time()); | 299 local ttl = cached_value and os.difftime(cached_value.expires, os.time()); |
| 303 if cached_value and ttl > (publication_interval + 60) then | 300 if cached_value and ttl > (publication_interval + 60) then |
| 304 module:log("debug", "Opt-in status (from cache) for '%s': %s", remoteDomain, cached_value.opt_in) | |
| 305 return cached_value.opt_in; | 301 return cached_value.opt_in; |
| 306 end | 302 end |
| 307 | 303 |
| 308 -- We don't have a cached value, or it is nearing expiration - refresh it now | 304 -- We don't have a cached value, or it is nearing expiration - refresh it now |
| 309 -- TODO worry about not having multiple requests in flight to the same domain.cached_value | 305 -- TODO worry about not having multiple requests in flight to the same domain.cached_value |
