fireproofsocks
Up until now, I’ve used spawn along with send and receive – this works well for things like parallel fetching of multiple URLs simultaneously.
Forgive me: concurrency is not something I’m an expert at, but is it considered bad form to spawn a process and not send or receive messages?
My specific use case is that I want to paginate through a bunch of database records, say 50 or 100 at a time. The only calculation that is immediately necessary is calculating the next database query (by increasing the offset parameter). The processing of this data could all be done async via a separate thread, but since the result of the data is always a side effect (like writing data to a file or inserting another database record), I don’t need to use Enum.map to associate caller PIDs with received messages. Is that normal to sort of “throw away” a process by ignoring any value it sends back? Now that I think about it, I could have structured my parallel URL scraping in this way: instead of receiving a response, I could have just written data to a database etc. in the separate thread. Right? Would that be a bad pattern?
Thanks for the guidance.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
wojtekmach
It is totally fine to use a process just for side effects and not communicate with it. Thats basically what
Task.start_linkis for.