You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, nice project, it's cool to see an experiment like this.
I didn't look at the code but is the state restored if the actor (task) is restarted ?
Although I never used the real OTP (nor do I know erlang), from what I read about it it should be, am i right ?
Anyway, thanks for sharing this, it's quite inspiring !
The text was updated successfully, but these errors were encountered:
I think you're talking about the state of a gen_server. In that case, no the state is not restored (same for the real OTP).
The state of a gen_server is temporary and lives only in memory. It's very common to have a connection handle to a database as state for example. If a temporary network failure occurs, the gen_server will crash and be restarted by the parent supervisor, creating a new connection (successfully once the temporary network failure is resolved).
If you need persistance, the real OTP gives you:
ETS (Erlang Term Storage), an in-memory key/value store that runs in its own process (or task)
DETS (Distributed ETS), which is replicated/balanced over the cluster. We can't do that here, this library does not support clustering (yet???)
Mnesia, which is based on DETS and allows on-disk persistance (if you know RabbitMQ, that's what they use to store the messages)
Yes, in the Erlang/Elixir world you don't need Redis 😉
TL;DR: If you need persistance over restarts, you should rely on an external service like Redis, Memcached, or a database, and hold the connection to this service in the gen_server's state
Repository owner
locked and limited conversation to collaborators
Dec 1, 2021
Hi, nice project, it's cool to see an experiment like this.
I didn't look at the code but is the state restored if the actor (task) is restarted ?
Although I never used the real OTP (nor do I know erlang), from what I read about it it should be, am i right ?
Anyway, thanks for sharing this, it's quite inspiring !
The text was updated successfully, but these errors were encountered: