jeudi 13 juin 2019

Web site and API connection

If we make use of some API connection in our code, we cannot be sure that it will always respond ( it can go down because of DDoS or simply because of maintenance ). Then our website will not respond as expected because it depends on that API. What can we do to prevent that? Can we make a thread and tell the method if n time passes, return Math random, for example? What is a good practice?

int random() {
int x = /api call/;
return x;
}

Aucun commentaire:

Enregistrer un commentaire