-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now move method returns a future. #6
base: master
Are you sure you want to change the base?
Conversation
Most changes are in Kernel. This solution uses a semaphore to minimize modifications to the code but a more async solution should be possible.
I assumed a synchronous API was acceptable here, because the application runs a single bot, and it's ok to block a single thread. |
Yes, I understand. I was also disappointed to have to introduce a semaphore. I'll look for a solution without semaphores (most likely with the type of ExecutionEnvironment used for testing) and update this PR. (When you say "a synchronous solution here" do you mean to use an Await construct...?) |
I mean that the function doesn't return a Future. |
OK, I updated it, let me know what you think. |
@@ -65,7 +69,7 @@ object Main { | |||
def step(server: Server, input: Input) { | |||
if (!input.game.finished) { | |||
print(".") | |||
step(server, server.move(input.playUrl, bot move input)) | |||
step(server, server.move(input.playUrl, Await.result(bot move input, 60.minutes))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it shouldn't wait for 60 minutes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I changed it to 1sec
Most changes are in Kernel. This solution uses a semaphore to minimize
modifications to the code but a more async solution should be possible.
Closes #3.