Is there any way for koa to return to a state first and do something else?

because it is time-consuming to run, you need to return a result first. Is there any way for koa to implement other operations?

May.10,2022

you mean asynchronous requests?


"other operations" without await.


return first, what is the meaning of your next operation?

  1. at the http client level, the semantics already means "submitting the task" rather than "getting the task result". Do you need to add push or pull polling to see the task status?
  2. at the back-end level, http, which has already been response, continues to be an operation in this code snippet, can I understand it? Another: even if it can, then the result of the operation can also affect the server state in a certain way, which needs to be persisted. Or create a new worker thread to process.
Menu