Hi, I was wondering if there is a special reason w...
# ktor
a
Hi, I was wondering if there is a special reason why the
ResponseSent
and
ReceiveRequestBytes
hooks don't have suspending handlers? At least the latter is given a
ByteReadChannel
so suspending calls should be quite common?
👀 1
a
@e5l
e
Hey @Andreas Scheja, thanks for the question. Could you tell me why do you need suspension in
ResponseSent
? As for
ReceiveRequestBytes
, we can add suspension there. I made a ticket: https://youtrack.jetbrains.com/issue/KTOR-5406/Add-suspend-modifier-to-ReceiveRequestBytes-hook
a
@e5l I have no use case where I would need it for
ResponseSent
right now, but is there a compelling reason not to change it? I mean if you want to call something suspending in there (and can't just
launch
it in a fire-and-forget manner) you have to bridge it with
runBlocking
, which would block the thread of the coroutine calling the hook -> not a good solution for a busy server.