Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-30990

Avoid execution of stale timers

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Declined
    • Major
    • feature-backlog
    • 6.0.0
    • eventing
    • None

    Description

      If timers are created in the past, they are still executed in the next available time slot. If someone accidentally(javascript math anomalies) creates timers few years or decades in the past, they are still executed when system resources are available. 

      It would be useful to contain this behaviour by exposing a parameter(modifiable via REST endpoint) that captures a stale window.

      At execution: a check is done before the timer is executed, if stale, do not fire.

      At Creation : a check is done at timer's creation, if stale, eventing could throw a warning/exception with a specific code.

      In the absence of such a check, developer has to write the following check in his/her code:

      func callback(context)

      {

        //context.my_deadline is the parameter in the timer payload
          if new Date().getTime() > context.my_deadline

        {

           // stale-window exceeded, do not execute the rest of the timer
           return;

           }
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            siri Sriram Melkote (Inactive)
            venkatraman.subramanian Venkatraman Subramanian (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty