tiagodavi

tiagodavi

Hey Guys. I would like to ask a couple of questions about Ecto and Async tasks.

1 - Are there plans to improve the way we use Ecto + Async Tests + Async Code? Using SQL.Sandbox is in IMHO really confusing.

2 - Are there best practices to use async tests + async code ?

3 - Let’s imagine I have a GenServer Process that inserts 1000 lines each hour using Repo.insert instead of using Repo.insert_all. Would that be a problem to kill my process and my entire application? Does Ecto try to get a new connection from database pool for each insert using Repo.insert?

4 - Let’s imagine I have a async task in my code that does not matter that result to the user, but I want to test it. Should I send a message to the parent process to use assert_receive?

Thank you in advance.

Showing Posts 1 to 2

hauleth

hauleth

  1. I do not know if it would be possible while keeping all niceties of SQL.Sandbox (especially fact that everything is ran within single transaction, which allows asynchronous testing with Postgres).
  2. There is documentation of Ecto.Adapters.SQL.Sandbox.
  3. Yes, Ecto checks out new connection from pool for each insert unless you will do it on your own via Repo.transaction or Repo.checkout
  4. It depends on the task. You can even test it synchronously if you want. There is no “one-fit-them-all” solution.
tiagodavi

tiagodavi OP

Thank you!

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
perzanko
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New

Other Trending Topics Top

mat-hek
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn: This is possible because it now builds on a very stab...
New
dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews