Handle long-running server processes cleanly in JavaScript.