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

[BP MB-39077] Timers are not cancelled if multiple timers created with same refrence

    XMLWordPrintable

    Details

      Description

      As per eventing specification for timers 

      createTimer(callback, date, reference, context)

      reference

      This is a unique string that must be passed in to help identify the timer that is being created. References are always scoped to the function and callback they are used with and need to be unique only within this scope. The call returns the reference string if timer was created successfully. If multiple timers are created with the same unique reference, old timers with the same unique reference are implicitly cancelled. If the reference parameter is set to JavaScript null value, a unique reference will be generated. 

      Observed that with the following handler i am seeing that old timers with same unique reference are not cancelled

      function OnUpdate(doc,meta) {
          var expiry = new Date();
          expiry.setSeconds(expiry.getSeconds() + 150);    var context = {docID : meta.id, random_text : "e6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh0R7Aumoe6cZZGHuh07Aumoe6cZZGHuh07Aumoe6cZZGHuh07Aumoe6"};
          createTimer(timerCallback,  expiry, "hello", context);
      }
      function timerCallback(context) {
          dst_bucket[context.docID] = context.random_text;
      } 

        Attachments

          Issue Links

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

            Activity

            Hide
            jeelan.poola Jeelan Poola added a comment -

            This will be addressed as part of the Improvement MB-38729 - Implement cancelTimer(). The MB is to track the actual test from QE perspective.

            Show
            jeelan.poola Jeelan Poola added a comment - This will be addressed as part of the Improvement MB-38729 - Implement cancelTimer() . The MB is to track the actual test from QE perspective.
            Hide
            jeelan.poola Jeelan Poola added a comment -

            Resolving as cancelTimer() is now part of 6.6.0 builds.

            Show
            jeelan.poola Jeelan Poola added a comment - Resolving as cancelTimer() is now part of 6.6.0 builds.
            Hide
            vikas.chaudhary Vikas Chaudhary added a comment -

            verified on 6.6.0 build 7737

            Show
            vikas.chaudhary Vikas Chaudhary added a comment - verified on 6.6.0 build 7737

              People

              Assignee:
              jeelan.poola Jeelan Poola
              Reporter:
              vikas.chaudhary Vikas Chaudhary
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes

                    PagerDuty