Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4665

Add a new AjaxChannel that discards any Ajax requests if there is a running request in the same channel

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.0.0-beta3
    • 1.5.8, 6.0.0
    • wicket
    • None

    Description

      The schedule JavaScript function of the ajax channel uses a BUSY flag and a request queue in a callbacks array.

      If the channel is marked as busy because there is a request currently being executed, the second part of the function is executed and for channel type DROP, the newly scheduled request is put into the callbacks queue.

      Using this approach, the dropping channel type actually allows 2 requests in the "total queue".
      The one that triggers the busy = true which is still running and the one that is stored into the callbacks array.

      Reading the documentation of AjaxChannel.DROP says:

      dropping - only the last Ajax request is processed, the others are discarded

      schedule: function (callback) {
      if (this.busy === false) {
      this.busy = true;
      try

      { return callback(); }

      catch (exception)

      { this.busy = false; Wicket.Log.error("An error occurred while executing Ajax request:" + exception); }

      } else {
      Wicket.Log.info("Channel busy - postponing...");
      if (this.type === 's')

      { // stack this.callbacks.push(callback); }

      else

      { /* drop */ this.callbacks = []; // THIS IS WRONG this.callbacks[0] = callback; }

      return null;
      }
      },

      To make it work, the dropping channel should NOT store the currently scheduled request, but simply clear the callbacks array.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mgrigorov Martin Tzvetanov Grigorov
            coldiges Christian Oldiges
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment