@@ -61,8 +61,7 @@ function Raven() {
61
61
this . _keypressTimeout ;
62
62
this . _location = _window . location ;
63
63
this . _lastHref = this . _location && this . _location . href ;
64
- this . _backoffDuration = 0 ;
65
- this . _backoffStart = null ;
64
+ this . _resetBackoff ( ) ;
66
65
67
66
for ( var method in this . _originalConsole ) { // eslint-disable-line guard-for-in
68
67
this . _originalConsoleMethods [ method ] = this . _originalConsole [ method ] ;
@@ -199,6 +198,10 @@ Raven.prototype = {
199
198
200
199
self . _globalEndpoint = self . _globalServer +
201
200
'/' + path + 'api/' + self . _globalProject + '/store/' ;
201
+
202
+ // Reset backoff state since we may be pointing at a
203
+ // new project/server
204
+ this . _resetBackoff ( ) ;
202
205
} ,
203
206
204
207
/*
@@ -1322,6 +1325,11 @@ Raven.prototype = {
1322
1325
return httpData ;
1323
1326
} ,
1324
1327
1328
+ _resetBackoff : function ( ) {
1329
+ this . _backoffDuration = 0 ;
1330
+ this . _backoffStart = null ;
1331
+ } ,
1332
+
1325
1333
_shouldBackoff : function ( ) {
1326
1334
return this . _backoffDuration && now ( ) - this . _backoffStart < this . _backoffDuration ;
1327
1335
} ,
@@ -1480,8 +1488,7 @@ Raven.prototype = {
1480
1488
data : data ,
1481
1489
options : globalOptions ,
1482
1490
onSuccess : function success ( ) {
1483
- self . _backoffDuration = 0 ;
1484
- self . _backoffStart = null ;
1491
+ self . _resetBackoff ( ) ;
1485
1492
1486
1493
self . _triggerEvent ( 'success' , {
1487
1494
data : data ,
0 commit comments