DWR

Allow users to set an alternative error handler for polling errors and to specify a retry policy

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Normal Normal
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 3.0.RC3
  • Component/s: Engine
  • Documentation Required:
    No
  • Description:
    Hide
    In 2.0 pollErrorHandler is not customizable and the retry policy is hard coded. An application may want to be notified when reverse AJAX failed and to specify the number
    of retries and delays between them (e.g. in a clustered environment, we want to retry without a delay a couple of times and then increase the delay).
    I suggest to add an additional user-level error handler, which takes a retry number (in addition to the error message) and returns the next retry delay or -1 to cancel retrying.
    For example, a handler, which implements the current retry policy:

    function(message, ex, retryNum) {
      // if anything goes wrong then just silently try again (up to 3x) after 10s
      return retryNum < 3 ? 10000 : -1;
    };
    Show
    In 2.0 pollErrorHandler is not customizable and the retry policy is hard coded. An application may want to be notified when reverse AJAX failed and to specify the number of retries and delays between them (e.g. in a clustered environment, we want to retry without a delay a couple of times and then increase the delay). I suggest to add an additional user-level error handler, which takes a retry number (in addition to the error message) and returns the next retry delay or -1 to cancel retrying. For example, a handler, which implements the current retry policy: function(message, ex, retryNum) {   // if anything goes wrong then just silently try again (up to 3x) after 10s   return retryNum < 3 ? 10000 : -1; };
  1. dwr-poll-error-handler.patch
    (4 kB)
    Ilya Perminov
    27/Apr/07 8:09 PM

Activity

Hide
Ilya Perminov added a comment - 27/Apr/07 8:09 PM

A patch, which implements the idea.

Show
Ilya Perminov added a comment - 27/Apr/07 8:09 PM A patch, which implements the idea.
Ilya Perminov made changes - 27/Apr/07 8:09 PM
Field Original Value New Value
Attachment dwr-poll-error-handler.patch [ 10020 ]
Joe Walker made changes - 02/May/07 3:43 PM
Fix Version/s 2.2 [ 10025 ]
Joe Walker made changes - 29/Feb/08 10:19 AM
Fix Version/s 3.0.M2 [ 10051 ]
Fix Version/s 3.0 [ 10025 ]
Joe Walker made changes - 14/Mar/08 4:48 PM
Status Open [ 1 ] In Progress [ 3 ]
Joe Walker made changes - 30/Oct/08 5:52 PM
Status In Progress [ 3 ] Open [ 1 ]
Joe Walker made changes - 15/Dec/08 11:17 PM
Fix Version/s 3.0.RC1 [ 10051 ]
Fix Version/s 3.0.RC2 [ 10090 ]
Hide
David Marginian added a comment - 08/Apr/09 9:44 AM

Opinions on the patch?

Show
David Marginian added a comment - 08/Apr/09 9:44 AM Opinions on the patch?
David Marginian made changes - 08/Apr/09 9:44 AM
Assignee Joe Walker [ joe ] Team [ team ]
David Marginian made changes - 24/Apr/09 2:06 AM
Priority Major [ 3 ] Normal [ 6 ]
David Marginian made changes - 22/May/09 4:27 AM
Fix Version/s 3.0 [ 10025 ]
Fix Version/s 3.0.RC2 [ 10090 ]
Hide
David Marginian added a comment - 25/May/09 7:09 PM

My thinking is that instead of the patch we can add setters for _maxPollRetries and _retryIntervals.

Show
David Marginian added a comment - 25/May/09 7:09 PM My thinking is that instead of the patch we can add setters for _maxPollRetries and _retryIntervals.
David Marginian made changes - 23/Jun/09 4:44 AM
Assignee Team [ team ] David Marginian [ davidmarginian ]
Hide
David Marginian added a comment - 23/Jun/09 4:52 AM

I have added the following setters:

/*

  • The maximum number of retries before failure.
  • @param - maxRetries - The maximum number of retries before failure.
    */
    dwr.engine.setMaxRetries = function(maxRetries) { dwr.engine._maxRetries = maxRetries; };

/*

  • The intervals between successive retries in seconds
  • @param - array of integers representing the retry interval in seconds.
    */
    dwr.engine.setRetryIntervals = function(intervalsArray) { dwr.engine._retryIntervals = intervalsArray; };

After maxRetries has been reached the errorHandler will now be called.

Show
David Marginian added a comment - 23/Jun/09 4:52 AM I have added the following setters: /*
  • The maximum number of retries before failure.
  • @param - maxRetries - The maximum number of retries before failure. */ dwr.engine.setMaxRetries = function(maxRetries) { dwr.engine._maxRetries = maxRetries; };
/*
  • The intervals between successive retries in seconds
  • @param - array of integers representing the retry interval in seconds. */ dwr.engine.setRetryIntervals = function(intervalsArray) { dwr.engine._retryIntervals = intervalsArray; };
After maxRetries has been reached the errorHandler will now be called.
David Marginian made changes - 23/Jun/09 4:52 AM
Fix Version/s 3.0.RC2 [ 10090 ]
Fix Version/s 3.0 [ 10025 ]
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Marginian made changes - 08/Aug/10 10:48 AM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Hide
David Marginian added a comment - 24/Aug/10 5:16 AM

Recent changes have been made:

1) Error handler is called immediately.
2) n-1 retries (where n is _retryIntervals.length) are attempted then the status is changed to offline (pollStatusHandler is called)
3) We continue to poll at _retryIntervals(_retryIntervals - 1) interval while we are offline.
4) When we are online pollStatusHandler is called again.

Show
David Marginian added a comment - 24/Aug/10 5:16 AM Recent changes have been made: 1) Error handler is called immediately. 2) n-1 retries (where n is _retryIntervals.length) are attempted then the status is changed to offline (pollStatusHandler is called) 3) We continue to poll at _retryIntervals(_retryIntervals - 1) interval while we are offline. 4) When we are online pollStatusHandler is called again.
David Marginian made changes - 24/Aug/10 5:16 AM
Status Reopened [ 4 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Documentation Required Yes
David Marginian made changes - 09/Nov/10 8:46 PM
Documentation Required Yes No
David Marginian made changes - 13/Jul/11 4:25 AM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Hide
David Marginian added a comment - 13/Jul/11 4:25 AM

Re-opening this for a minor change.

Show
David Marginian added a comment - 13/Jul/11 4:25 AM Re-opening this for a minor change.
David Marginian made changes - 13/Jul/11 4:26 AM
Fix Version/s 3.0.RC3 [ 10120 ]
Fix Version/s 3.0.RC2 [ 10090 ]
Mike Wilson made changes - 29/Nov/12 3:51 PM
Fix Version/s 3.0.RC4 [ 10140 ]
Fix Version/s 3.0.RC3 [ 10120 ]
David Marginian made changes - 05/Dec/12 7:02 PM
Status Reopened [ 4 ] In Progress [ 3 ]
David Marginian made changes - 05/Dec/12 7:02 PM
Fix Version/s 3.0.RC3 [ 10120 ]
Fix Version/s 3.0.RC4 [ 10140 ]
David Marginian made changes - 07/Dec/12 4:24 AM
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]

People

Dates

  • Created:
    27/Apr/07 8:07 PM
    Updated:
    07/Dec/12 4:24 AM
    Resolved:
    07/Dec/12 4:24 AM