I am currently facing an issue with my web server. Whenever a request is made, the server initiates a phone call, waits for 3 seconds, and then checks if the call is still ongoing. I have utilized setTimeout
to achieve this functionality, but it seems to block all other connections until the timeout has completed.
// Sample GET request
app.get("/", function(req, res) {
// Perform an action
example.makeCall(function() {
setTimeout(function() {
// Check the action
example.checkCall(function() {
res.status(200)
})
}, 3000)
})
})
I am wondering if there is an alternative method to implement a timeout for requests without interfering with incoming connections?