Announcement

Collapse
No announcement yet.

Restarting plugin - restoring state?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Restarting plugin - restoring state?

    Question about restarting a plugin, mostly applies to remote plugin.
    If my plugin looses communication with HS - I can restart it and reconnect.
    But question is: if my plugin has a timer and after timer expire I change some device status - what's common tecnique for storing timer information and restoring it after restart?
    Is it even possible?

    #2
    You need to store the state somewhere and read it back yourself. If your timers are device related (e.g. they tie to a single device) then look at the device extended data objects, you can store whatever you want in them (using a dictionary here is a simple way to store values and you can avoid future serialization issues if you stay with primitives in the dictionary). Another common option is to put entries in your ini file. Third, you can write to a local file, this will be available of course only if the plugin is run from the same location each time (e.g. on the HS server vs remotely)

    Comment


      #3
      Thanks Bill, looks like we are talking to each other
      I probably didn't explain correctly the problem. I know how to store settings in PED or ini, my question is - if say timer is set to 5 minutes and after the timer started the plugin (or HS) restart. Would be nice to restrt the timer for the reminding timeout. I undrstand it's too much to ask, but... One option I guess is to store timer expiration Timestamp, ans then after restart it's easy to find the timer reminder.

      BTW, what's HS event "Include in Powerfailure Recovery" option, what does it do?

      Comment


        #4
        Originally posted by alexbk66 View Post
        Thanks Bill, looks like we are talking to each other
        I probably didn't explain correctly the problem. I know how to store settings in PED or ini, my question is - if say timer is set to 5 minutes and after the timer started the plugin (or HS) restart. Would be nice to restrt the timer for the reminding timeout. I undrstand it's too much to ask, but... One option I guess is to store timer expiration Timestamp, ans then after restart it's easy to find the timer reminder.

        BTW, what's HS event "Include in Powerfailure Recovery" option, what does it do?
        You need to store the timer expiration time and re-create it yourself.

        The powerfail recover runs time based events that didn't fire if the system was down for some period. E.g. if you have the recovery time to 30 minutes and your event should have fired 25 minutes ago, it will fire. But if the event should have fired 35 mins ago, it will not...

        Comment

        Working...
        X