File tree Expand file tree Collapse file tree 2 files changed +21
-24
lines changed
packages/browser/src/transports Expand file tree Collapse file tree 2 files changed +21
-24
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5- - Coming soon...
5+ - [ browser ] ref: Fix regression with bundle size
66
77## 5.9.0
88
Original file line number Diff line number Diff line change @@ -33,29 +33,26 @@ export class FetchTransport extends BaseTransport {
3333 } ;
3434
3535 return this . _buffer . add (
36- new SyncPromise < Response > ( async ( resolve , reject ) => {
37- let response ;
38- try {
39- response = await global . fetch ( this . url , defaultOptions ) ;
40- } catch ( err ) {
41- reject ( err ) ;
42- return ;
43- }
44-
45- const status = Status . fromHttpCode ( response . status ) ;
46-
47- if ( status === Status . Success ) {
48- resolve ( { status } ) ;
49- return ;
50- }
51-
52- if ( status === Status . RateLimit ) {
53- const now = Date . now ( ) ;
54- this . _disabledUntil = new Date ( now + parseRetryAfterHeader ( now , response . headers . get ( 'Retry-After' ) ) ) ;
55- logger . warn ( `Too many requests, backing off till: ${ this . _disabledUntil } ` ) ;
56- }
57-
58- reject ( response ) ;
36+ new SyncPromise < Response > ( ( resolve , reject ) => {
37+ global
38+ . fetch ( this . url , defaultOptions )
39+ . then ( response => {
40+ const status = Status . fromHttpCode ( response . status ) ;
41+
42+ if ( status === Status . Success ) {
43+ resolve ( { status } ) ;
44+ return ;
45+ }
46+
47+ if ( status === Status . RateLimit ) {
48+ const now = Date . now ( ) ;
49+ this . _disabledUntil = new Date ( now + parseRetryAfterHeader ( now , response . headers . get ( 'Retry-After' ) ) ) ;
50+ logger . warn ( `Too many requests, backing off till: ${ this . _disabledUntil } ` ) ;
51+ }
52+
53+ reject ( response ) ;
54+ } )
55+ . catch ( reject ) ;
5956 } ) ,
6057 ) ;
6158 }
You can’t perform that action at this time.
0 commit comments