File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class JSONCache extends EventEmitter {
3535 * @param {number } options.maxRetry maximum number of attempts to retry getting data
3636 * @param {function } options.integrity optional function to check if the data is worth keeping
3737 */
38- constructor ( url , timeout = 60000 , options ) {
38+ constructor ( url , timeout , options ) {
3939 super ( ) ;
4040
4141 // eslint-disable-next-line no-param-reassign
@@ -51,7 +51,7 @@ class JSONCache extends EventEmitter {
5151 this . protocol = this . url . startsWith ( 'https' ) ? require ( 'https' ) : require ( 'http' ) ;
5252
5353 this . maxRetry = maxRetry ;
54- this . timeout = timeout ;
54+ this . timeout = timeout || 60000 ;
5555 this . currentData = null ;
5656 this . updating = null ;
5757 this . Promise = promiseLib ;
@@ -71,7 +71,7 @@ class JSONCache extends EventEmitter {
7171 }
7272
7373 getData ( ) {
74- if ( this . delayStart ) {
74+ if ( this . delayStart && ! this . currentData && ! this . updating ) {
7575 this . startUpdating ( ) ;
7676 }
7777 if ( this . updating ) {
You can’t perform that action at this time.
0 commit comments