Open TimMoore opened 7 years ago
Technically there's no problem with this, the worst that will happen is that duplicate commands get sent to end the auction, but the auction entity is tolerant to this.
I agree that it isn't important in this specific case, but since this is the go-to example for scheduled tasks, and since many use cases will require a cluster singleton, I still think it's worth doing here as an example for others.
For that we should probably provide an abstraction in Lagom, perhaps offering the ability to schedule something once on every node, to schedule something as a cluster singleton, and to distribute a list of scheduled tasks across all the nodes.
AuctionScheduler
is not cluster aware: it will run its scheduled task on all nodes.We should demonstrate use of a cluster singleton to ensure it only runs on one node.
(We should port this change to Scala as well.)