Using SubscriptionRef for Shared State and Persistence in Cluster Entities
I am wondering if this is a dumb idea, or I am not using cluster entites properly:
The idea is that when the entity spins up, it populates some data from a database in a SubscriptionRef. The entity also subscribes to this ref and saves any changes to it to the database in a
The problem becomes if the initial data population or persistence fails, what happens to the entity i guess. And the Entity.toLayer always ensures the error channel is
I mostly want to do this so I can share state between requests and I cant think of a better way to do it inside of the cluster entity
The idea is that when the entity spins up, it populates some data from a database in a SubscriptionRef. The entity also subscribes to this ref and saves any changes to it to the database in a
forkScope fiber. Then as messages come in, they can reference and update this shared ref without having to worry about data persistence inside the actual message handler. The problem becomes if the initial data population or persistence fails, what happens to the entity i guess. And the Entity.toLayer always ensures the error channel is
never so I either have to catch every error at this level or dieI mostly want to do this so I can share state between requests and I cant think of a better way to do it inside of the cluster entity
