[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to isSet() check for a Timer

There is not a way to check if a timer has been set. It would be a different & more expensive protocol if that API were available. Timers are deliberately a "blind write" API. The best approach today is just what you said - add a ValueState<Boolean>. But that negates the performance benefits of the API design.

But your use case is actually probably many uses of timers. I'm adding the dev list to broadcast the use case. It probably makes sense to have a "set if unset" API and/or a "set to the minimum of current time and this new time" API, both still "blind writes".


On Fri, Nov 2, 2018 at 8:55 PM Reza Ardeshir Rokni <rarokni@xxxxxxxxx> wrote:

I have a need to set an alarm in both the Element DoFn as well as the OnTimer code block. I need to ensure that I do not overwrite a already set timer, is there a way to check if a Timer has been set?

One thought was to use a ValueState<Boolean> which I can manually set / unset as part of the operations. Thoughts?