Of course, you can add withTaskCancellationHandler
inside withTimeout
.
But probably you can leave it to the operation to decide how the cancellation needs to be handled.
You can pass your non-supporting operation wrapped with withTaskCancellationHandler
and then pass to withTimeout
.
Also, handling cancellations with an actor is probably not what you should do.
Look at the thread How to use withTaskCancellationHandler properly? which extensively tries to exhaust this topic.