robaho / go-trader

financial exchange written in Go, designed for algorithmic trading tests
GNU General Public License v3.0
376 stars 75 forks source link

make sure the goroutine wont shut down in a docker #20

Open napoleon665 opened 1 month ago

robaho commented 1 month ago

It would be helpful if you are a bit more explicit in the problem statement.

I gather that what is happening is that the Docker container does not have standard input available, so the processing of standard input terminates leading to shutdown.

A few things:

The changes break the current interactive behavior, because if the user types quit, the process will still hang on the outer select and not terminate.

I believe the proper fix is to be more explicit. Move the input processing to its own function, and in the main() check if standard input is available and if so call the function, and if not perform the infinite select.

What do you think?

robaho commented 1 month ago

@napoleon665 did you see my previous question?