File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
src/browser/extension/utils Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 11let handleError ;
2+ let lastTime = 0 ;
3+
4+ function createExpBackoffTimer ( step ) {
5+ let count = 1 ;
6+ return function ( reset ) {
7+ // Reset call
8+ if ( reset ) {
9+ count = 1 ;
10+ return 0 ;
11+ }
12+ // Calculate next timeout
13+ let timeout = Math . pow ( 2 , count - 1 ) ;
14+ count += 1 ;
15+ return timeout * step ;
16+ } ;
17+ }
18+
19+ const nextErrorTimeout = createExpBackoffTimer ( 1000 ) ;
220
321function postError ( message ) {
422 if ( handleError && ! handleError ( ) ) return ;
@@ -10,7 +28,11 @@ function postError(message) {
1028}
1129
1230function catchErrors ( e ) {
13- if ( window . devToolsOptions && ! window . devToolsOptions . notifyErrors ) return ;
31+ if (
32+ window . devToolsOptions && ! window . devToolsOptions . notifyErrors
33+ || e . timeStamp - lastTime < nextErrorTimeout ( )
34+ ) return ;
35+ lastTime = e . timeStamp ; nextErrorTimeout ( true ) ;
1436 postError ( e . message ) ;
1537}
1638
You can’t perform that action at this time.
0 commit comments