Hello, Do you know how I can prevent a job to be ...
# coroutines
t
Hello, Do you know how I can prevent a job to be run if one is already running?
Copy code
// From Ktor
    get("/longtask") {
        call.respondText("OK")

        runLongTask(settings) // Returns a Job
    }
What I would like is, when
/longtask
is called for the first time, call the function
runLongTask
, but if it's called a second time, and
runLongTask
from the first call is not finished yet, to run it again. Not at all.
e
So do you want to run it the second time or not?
t
Not :)