Joke Collection Website - Public benefit messages - How to judge the timeout of front-end calling back-end interface

How to judge the timeout of front-end calling back-end interface

Record the request time (start time) when the front end requests, and record the curl status value (end time) when the interface returns to the data interface.

The acquisition method of status value: $ httpcode = curl _ getinfo ($ ch, curl info _ http _ code);

For example, set 10s to timeout.

When the end time-start time is 10s, it is recorded in the redis queue.

When the state value! = 200, recorded in redis queue.

Then the back end consumes queues, such as writing data, or sending text messages, emails and so on.