mmport80
Handle_continue callback for OTP - good or bad?
Async init call seems like a bad idea… Perhaps it’s sometimes necessary, just as cutting ones arm off might be in extreme situations ; ) - just trolling, would like to hear more.
Most Liked
blatyo
A common scenario for lazy init is establishing a connection to an external system like a database or a message broker. You don’t want to establish the connection in the init because it may fail and you then loose the ability for your supervisor to recover that process.
amnu3387
I think it expresses actually what you want when trying to use send’s inside the init or right after creation of a genserver, which is start and this is your first message, but what was actually expressed with send was start and here's a message which could end up in race conditions.
Extracting keys from maps in ets also seems like a great addition
mmport80
From the article:
This will do just what you wanted from the beginning - execute the async initialization code before accepting any message, but allow parent supervisor to continue execution. No race conditions possible - “it just works” ™️!
OK, perhaps it makes sense. Teaches me for firing off a post before reading the full article…
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








