If a user registers an url but no web server started on this url, ElevatorIsBrokenException is thrown and no way to get new http requests from code-elevator server
Closed this issue · 6 comments
The use case is the following:
- Start a new code-elevator server (
mvn --file elevator-server/pom.xml jetty:run
) - Register a new user with URL http://localhost:4444 (no code elevator client listening on http://localhost:4444)
=> you get the following trace in the server console:
HTTPElevator http://localhost:4444/reset?cause=the+elevator+is+at+floor+0+and+its+doors+are+closed
Exception in thread "Thread-13" elevator.exception.ElevatorIsBrokenException: Connection refused
at elevator.server.HTTPElevator.httpGet(HTTPElevator.java:115)
at elevator.server.HTTPElevator.httpGet(HTTPElevator.java:102)
at elevator.server.HTTPElevator.reset(HTTPElevator.java:96)
at elevator.Building.reset(Building.java:71)
at elevator.server.ElevatorGame.reset(ElevatorGame.java:118)
at elevator.server.ElevatorGame.updateState(ElevatorGame.java:75)
at elevator.server.ElevatorServer.lambda$start$1(ElevatorServer.java:108)
at java.util.TreeMap.forEach(TreeMap.java:1001)
at elevator.server.ElevatorServer.start(ElevatorServer.java:108)
at java.lang.Thread.run(Thread.java:745)
- start your code elevator client listening on http://localhost:4444
- click reset on the dashboard
HTTPElevator http://ocalhost:4444/reset?cause=player+has+requested+a+reset
The reset message is sent but the code elevator will not sent any nextCommand.
It is an important problem since if a user registers without an elevator client listening on the registered URL, he will never be able to start the game.
Thank you for your comprehensive description of the issue.
Can you validate that latest master version solve it ?
Please see f4a4bbe for details of resolution.
Thank you for the quick fix.
It now looks fine! The only thing is that I do not see any score penalty if the server is not reachable. I do not know if it is on purpose or not.
Ok I've had a new behavior to cover this case. Please see 20cb84d. If it suits your needs then you can close this issue.
Ok. If I connect a user with a non-reachable server, I now get a penalty of -9000 points (score in parenthesis). By the way, I'm new to code elevator: What is the difference between the main score and the score displayed between parenthesis?
ps: thanks for sharing this nice project
Score in parenthesis is the average score you get in 5 minutes.
Perfect. The issue is now solved. Thanks again