Node.js · Senior · Question 70 of 75

The client disconnects while your handler runs a slow database query. How do you avoid wasting work?

Explanation

Pass the signal to fetch, timers and libraries that support it. For databases, use query timeouts or cancellation if the driver supports them.

Further reading

Problem with a question

Node.js · Senior · question 70

Test yourself

Take the Node.js · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz