CmdrReplyUtils
Progress replies for commands that yield.
Cmdr prints nothing between dispatching a command and its body returning, so a command that spends seconds in a datastore retry ladder is indistinguishable from one that has hung. These replies fill that gap without adding a line to a command that finishes promptly.
local config = CmdrReplyUtils.createConfig()
return CmdrReplyUtils.replyWhenSlow(config, context, self:_promiseWork(userId), `{userId}: still working...`)
:Then(function(line) ... end)
Types
CmdrReplyConfig
interface CmdrReplyConfig {slowReplySeconds: number--
How long work is given to finish before the executor is told it is still running
}Functions
createConfig
Creates a new reply config.
The default threshold is long enough that a command which completes promptly stays silent, and the default color is muted so progress chatter does not compete with the results printed after it.
isCmdrReplyConfig
CmdrReplyUtils.isCmdrReplyConfig(config: any) → booleanReturns whether an object is a reply config.
replyWhenSlow
Replies text to the executor if promise is still running slowReplySeconds from now, and
says nothing at all if it settles first.
Returns the promise it was given, so it drops into an existing chain.