Software /
code /
prosody
Changeset
11949:ae4bc56f18e0
mod_admin_shell: Wait for promises
I've typed `>require"util.async".wait_for(...)` for the last time!
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Nov 2021 22:26:48 +0100 |
parents | 11948:dca75cc6fc5a |
children | 11950:d2a9e95fd27b |
files | plugins/mod_admin_shell.lua |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Sat Jan 05 07:15:33 2019 +0100 +++ b/plugins/mod_admin_shell.lua Fri Nov 26 22:26:48 2021 +0100 @@ -35,6 +35,7 @@ local serialization = require "util.serialization"; local serialize_config = serialization.new ({ fatal = false, unquoted = true}); local time = require "util.time"; +local promise = require "util.promise"; local t_insert = table.insert; local t_concat = table.concat; @@ -173,6 +174,10 @@ local taskok, message = chunk(); + if promise.is_promise(taskok) then + taskok, message = async.wait_for(taskok); + end + if not message then if type(taskok) ~= "string" and useglobalenv then taskok = session.serialize(taskok);