lundi 19 avril 2021

what is the best practice for handling asynchronous api call that take time

So suppose I have an api to create a cloud instance asynchronously. So after I made an api call it will just return the success response, but the cloud instance will not been initialized yet. It will take 1-2 minutes to create cloud instance and after that it will save the cloud instance information (ex. ip, hostname, os) to db which mean I have to wait 1-2 minutes so I can fetch the data again to show cloud information. At first I try making a loading component, but the problem is that I don't know when the cloud instance is initialized (each instance has different time duration for creating). I'm considering using websocket or using cron or should I redesign my api? Has anyone design asynchronous system before how do you handle such a case.

Aucun commentaire:

Enregistrer un commentaire