SQL Databases also typically have query timeouts on the DB side. When you cancel a context, the DB could still chug on that query for a while. For example, https://www.postgresql.org/docs/current/runtime-config-client.html (see statement_timeout). If you want to reliably cancel connections and not swamp your DB with runaway queries, do both.
On Sun, Jan 16, 2022 at 1:24 PM Brian Candler <b.cand...@pobox.com> wrote: > Oops, subject said mongoDB not SQL. But I think the point stands. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/6a5d0919-a828-41d4-8c53-722631013f68n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/6a5d0919-a828-41d4-8c53-722631013f68n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29Ls4dsZ7NQsHmmHknTrPnPSORSht-jr-YLDA_A3u2JzG6A%40mail.gmail.com.