Spot the bug in notification launch

from Kotlin backend development
Kotlin 2.4.10 / Ktor 3.5.1 / Java 25 LTS intermediate 4 min 1 issue to find

Why can this generated notification disappear after a successful response?

kotlin
fun Route.orderRoutes(service: OrderService, mailer: Mailer) {
    post("/orders") {
        val request = call.receive<CreateOrderRequest>()
        val order = service.create(request)

        GlobalScope.launch {
            mailer.sendConfirmation(order)
        }
        call.respond(HttpStatusCode.Created, order.toResponse())
    }
}
Open in playground
Report an error