Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Is there any way to skip delays and execute an ongoing Job #134

Open
vikasacharya16 opened this issue Nov 16, 2020 · 0 comments
Open

Is there any way to skip delays and execute an ongoing Job #134

vikasacharya16 opened this issue Nov 16, 2020 · 0 comments

Comments

@vikasacharya16
Copy link

vikasacharya16 commented Nov 16, 2020

I have a Job like below

job = GlobalScope.launch {
    delay(5000)
    runOnUiThread {
        some unwanted code
    }
}

This job will wait for 5 seconds to execute. And to cancel it before 5 seconds I'm calling

job?.cancel()

Now, Is there a way to execute this job before 5 seconds have reached ?

I'm looking for something like job?.forceExecute.ignoreDelays or job?.forceExecute.ignoreDelay("FirstDelay") if there is a option for name like delay(5000,"FirstDelay")

That would be so helpful for me to avoid boiler plate code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant