ScheduleEphemeralTask (open)
Schedule an ephemeral task if this transaction commits
Syntax
LOADLIB "mod::system/lib/tasks.whlib";
OBJECT FUNCTION ScheduleEphemeralTask(STRING tasktype, RECORD taskdata, RECORD options)
Parameters
STRING tasktype
Type of the task to schedule - refers to to the servicemanager:ephemeraltask in the moduledefinition
RECORD taskdata
Data for the task
RECORD options
Options
RECORD auxdata
Auxilliary data cells. This will be merged with the task data when passed to the task, but stored separately to avoid the 4K limit
STRING persistentcachekey
Key for the persistent cache of the task (available via taskcontext.persistentcache
)
STRING priority
Override the default task priority for this task type. Allowed values: '', 'background', 'normal', 'interactive', 'update', 'updateinteractive'.
Return value
OBJECT
Promise that will complete when the task is done, and returns the tasks value or an exception if the task failed
Description
An ephemeral task may be lost if the current script, the task itself or the task manager fails or ends Ephemeral tasks are often used when work needs to be done asynchronously, but the current script still needs the results. If the current script goes away, it's assumed that the task can go away and will not have any side effects.