How :timeout is selected in Multi?

I started wondering how timeout is applied when you specify it on different Multi actions or in Repo.transaction itself.

# what's the timeout for this one?
|> Multi.delete(:post1, post1, timeout: 300)
|> Multi.delete(:post2, post2, timeout: 200)
|> Repo.transaction()

# and for this one?
|> Multi.delete(:post, post, timeout: 300)
|> Repo.transaction(timeout: :infinity)

Are they treated independently? I’d expect all of those to be in single transaction with one specified timeout.

Timeout only works on Repo.transaction. Think of it as a timeout for the entire query. You can’t put timeouts on particular statements within a transaction. Any timeouts on the Multi functions will be ignored.

Actually I don’t think ^ is true anymore. Maybe someone who knows better will reply. It looks like maybe the transaction will error out if any of the timeouts are reached for any of the individual statements. And then if the timeout on the entire transaction is reached it aborts, no matter if the individual statement’s timeout was reached.