后浪云Moralis教程:Moralis Jobs
有时您想执行长时间运行的函数,并且不想等待响应。 Cloud Jobs
就是为此而生的。
定义一个Job
在您的云功能中定义Job。
Moralis.Cloud.job("myJob", (request) => {
// params: passed in the job call
// headers: from the request that triggered the job
// log: the Moralis Server logger passed in the request
// message: a function to update the status message of the job object
const { params, headers, log, message } = request;
message("I just started");
return doSomethingVeryLong(request);
});
安排Job
您可以通过单击右上角的“Schedule a job”在仪表板的“Jobs”部分安排Job。
选择描述、要运行的Job并在需要时提供参数
当您配置好您的工作后,您可以通过按右下角的“Schedule”来确认它。
版权声明:
作者:后浪云
链接:https://www.idc.net/help/193614/
文章版权归作者所有,未经允许请勿转载。
THE END