How do you cancel all running prisma queries for a...
# orm-help
b
How do you cancel all running prisma queries for a request? I want to do it when a request is taking longer than 30s.
n
Hey 👋 We don’t currently have an API for cancelling queries. But this is definitely a valid use case, would you mind creating a Feature Request? As of now, $disconnect is the only way to disconnect the database connection which as you said would cancel all queries.
b
thanks, i might do that later on. Now I think about it. Would it be possible to get PID of a query so I could kill using pg_cancel_backend for postgress?
n
I think that would be a good idea, I referred to this answer https://stackoverflow.com/questions/11291456/terminate-hung-query-idle-in-transaction You can get the pid manually through raw query and then can use it to cancel the ongoing query.
✅ 1