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.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b326af-2b176.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b326af-2b176.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?