Expand description
Work that must not hold up the plugin’s hooks. A plugin runs one call at
a time, so a slow lookup in login would keep chat waiting past its
deadline. Instead the hook defers its answer, hands the lookup to a
background worker and returns; the answer follows from job-done.
Functions§
- defer
- Call inside
login,initial-server,before-transfer,command,chatorkick: the hook’s own return value is ignored, and the answer is the one given toresolvewith the returned ticket. The hook’s deadline keeps running: an answer that comes too late counts as a missed deadline. An error outside those hooks, or when the call was deferred already. - is_
worker - Whether this instance is a background worker.
- resolve
- Answer a deferred hook. Returns false when nobody waits for the ticket any more (the deadline passed, or it was answered).
- run
- Queue
payloadfor the plugin’s background workers (manifest[background] workers, an error without any): one of them callswork(payload), and its result comes back throughjob-donewith the returned handle. At most 1024 jobs wait at a time.