You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Express.listen() spawns a separate thread to instantiate and start underlying HttpServer.
This introduces a race condition if an automated test is trying to execute an http call to the express app right after call to listen().
Workaround:
public void start(int port) {
System.out.println("Application starting...");
CountDownLatch latch = new CountDownLatch(1);
express = new Express();
//configuration of routes omitted
express.listen(latch::countDown, port);
latch.await();
System.out.println("Application started @ http://localhost:" + getPort());
}
I'd prefer not to have to use CountDownLatch.
The text was updated successfully, but these errors were encountered:
Express.listen() spawns a separate thread to instantiate and start underlying HttpServer.
This introduces a race condition if an automated test is trying to execute an http call to the express app right after call to listen().
Workaround:
I'd prefer not to have to use CountDownLatch.
The text was updated successfully, but these errors were encountered: