Prevent HTTP Request Getting Killed when Client Timeout

Hi all,

I want to prevent request getting killed when client timeout / client cancelled the request.
I found people faced similar problem e.g (Phoenix seems to stop processing a request after ~ a minute, and request process be killed when cancel a request, mysql transaction never commit or rollback · Issue #3503 · phoenixframework/phoenix · GitHub)

I was thinking if this is default behaviour, would it be dangerous if there are sneaky users, and they cancel requests / give a very short timeout? the DB transactions will not terminate gracefully.

It seems people use Task.async for this matter. Is this approach idiomatic in phoenix web application?

Wouldn’t the issue to fix here be the fact that the db transaction is never closed, rather than the web request being stopped?

in my case, my quite long delete statement cancelled due to client timeout.

But in general iam curious, how to deal (/appropriate way) with db transactions / long running db statement in Phoenix