Closed tonicebrian closed 1 year ago
Why would you expect to see 5 logs? My understanding of your ActionT
is that it receives a single message, increments a counter once, and then prints the current counter. If you want to loop and receive more, you'll have to do that explicitly. By adding a call to accountant
at the end of accountant
, I see:
*MyLib> main
Current counter at: 1
Current counter at: 2
Current counter at: 3
Current counter at: 4
Current counter at: 5
This is the end
I'll close this issue soon, let me know if you are satisfied with my response. Thanks for reminding me to update this package for modern GHCs, also!
Ohh, thank you, reminder to self: don't work late in the evening!!
As evidenced by my being up, sometimes its inevitable! What was your possible use case for stm-actor
, by the way?
I'm creating a game server for boardgames. There will be an actor holding the state of each game, game clients will connect using web sockets and they will modify the state through messages to the actor.
At first I thought about a ReaderT solution and manage the queue myself, but then I realized that there are two kind of states, the state for the match (which clients are connected and should receive updates) and the state of the game (only the game state itself, and 2 mailboxes to send commands to players).
Each has different concurrency requirements. For instance you cannot block the Match Actor waiting for a client to be available in order to send a move request because maybe you have enqueued a message to connect that missing client. So I realized that I was creating an actor system and looked around and found your actor framework.
Sounds fun! You may have better luck latency-wise going with unagi-chan rather than the underlying stm-queue library that backs this package, but my guess is that for most board games you should probably be fine with this library's performance as well.
By the way, I realize that my README documentation sort of conveyed that the example you gave should do what you expected. I just made a commit to hopefully clarify that you need to write a loop to continually log.
Yep, the README is clearer now. Thanks a lot for the library.
Hi, I'm evaluating your library to see if it will fit my use case but I cannot make it to work. Could you spot why this code doesn't work?
I'd expect to see 5 logs but I can only see 1:
Thanks!!