delay-timer icon indicating copy to clipboard operation
delay-timer copied to clipboard

Feature request: `DelayTimer` check if ID is in use

Open alpha-tango-kilo opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. I'd like to be able to check if a task with a specific ID is already being handled by DelayTimer, so I can avoid overwriting accidentally by inserting a new task with the same ID

Describe the solution you'd like

impl DelayTimer {
    pub fn has_task(&self, id: u64) -> bool {
        todo!()
    }
}

Describe alternatives you've considered A workaround I considered was trying to remove a task then re-adding it if it existed, however DelayTimer::remove_task doesn't return the task being removed

Additional context For use in my upcoming project

alpha-tango-kilo avatar Jun 01 '22 19:06 alpha-tango-kilo

alpha-tango-kilo

My friend, I got your description of your needs, Since getting an internal state is an asynchronous process, can add this API, but it needs to be called asynchronously. Is this convenient for you to call?

BinChengZhao avatar Jun 09 '22 07:06 BinChengZhao

Yeah that's fine if it needs to be async I can work with that. Thanks for your response!

alpha-tango-kilo avatar Jun 09 '22 09:06 alpha-tango-kilo

Yeah that's fine if it needs to be async I can work with that. Thanks for your response!

I'm sorry to say that I've been very busy lately, but if I have time I'll help you implement this API, thank you for your understanding.

BinChengZhao avatar Jun 20 '22 14:06 BinChengZhao

It's not a problem at all! You take all the time you need, it's not a blocking issue for me :)

alpha-tango-kilo avatar Jun 20 '22 18:06 alpha-tango-kilo