# HG changeset patch # User Kim Alvefur <zash@zash.se> # Date 1680891993 -7200 # Node ID e0b5468aae494dd8aa045449cc145b5dd7691791 # Parent e00e3e2c72a39661aa427a737abf9566a9cdca2e mod_rest: Allow passing configuring a timeout for <iq> responses The default 2 minutes is not how long you want to wait, sometimes. diff -r e00e3e2c72a3 -r e0b5468aae49 mod_rest/mod_rest.lua --- a/mod_rest/mod_rest.lua Fri Apr 07 15:21:54 2023 +0100 +++ b/mod_rest/mod_rest.lua Fri Apr 07 20:26:33 2023 +0200 @@ -390,7 +390,10 @@ module:hook(archive_event_name, archive_handler, 1); end - local p = module:send_iq(payload, origin):next( + local iq_timeout = tonumber(request.headers.prosody_rest_timeout) or module:get_option_number("rest_iq_timeout", 60*2); + iq_timeout = math.min(iq_timeout, module:get_option_boolean("rest_iq_max_timeout", 300)); + + local p = module:send_iq(payload, origin, iq_timeout):next( function (result) module:log("debug", "Sending[rest]: %s", result.stanza:top_tag()); response.headers.content_type = send_type;