ccarruitero/makemehapi

Exercises use inconsistent wait times when pausing for servers to come up

Closed this issue · 1 comments

Problem

When running some exercises (e.g. the directories) exercise, the I get the following output most of the time:

✗ Error connecting to http://localhost:57351: ECONNREFUSED

Error: connect ECONNREFUSED
    at errnoException (net.js:904:11)
    at Object.afterConnect [as oncomplete] (net.js:895:19)

Cause

The timeout in exercises/directories/exercise.js is 500ms. This is not long enough for both servers to come online. The exercises before the directories exercise (e.g. routes) use a 2000ms timeout.

Suggested solution

Make the timeout consistently 2000ms across all exercises.

Discussion

In my experience, this is difficult to reproduce when testing with a local installation of makemehapi. Further, the error is much more likely to occur when using the verify mode than the run mode. This is probably due to the fact that verify brings up two servers, which probably takes longer.

PR created (#141). Hope you like it.