@@ -78,19 +78,29 @@ export const trigger = () => {
7878 while ( queue . length ) {
7979 const bundle = queue [ 0 ] ;
8080 const inverseProbability = bundle . $inverseProbability$ ;
81+ console . log ( 'inverseProbability' , inverseProbability ) ;
8182 const probability = 1 - inverseProbability ;
83+ console . log ( 'probability' , probability ) ;
8284 console . log ( 'limit :' , limit ) ;
83- const allowedPreloads = graph
84- ? // The more likely the bundle, the more simultaneous preloads we want to allow
85- Math . max ( 1 , ( Number ( limit ) || config [ maxSimultaneousPreloadsStr ] ) * probability )
86- : // While the graph is not available, we limit to 2 preloads
87- 2 ;
88- console . log ( 'allowedPreloads :' , allowedPreloads ) ;
89- if ( preloadCount < allowedPreloads ) {
85+
86+ if ( probability === 1 ) {
9087 queue . shift ( ) ;
9188 preloadOne ( bundle ) ;
9289 } else {
93- break ;
90+ const allowedPreloads = graph
91+ ? // The more likely the bundle, the more simultaneous preloads we want to allow
92+ Math . max ( 1 , ( Number ( limit ) || config [ maxSimultaneousPreloadsStr ] ) * probability )
93+ : // While the graph is not available, we limit to 2 preloads
94+ 2 ;
95+ console . log ( 'allowedPreloads :' , allowedPreloads ) ;
96+ console . log ( 'preloadCount :' , preloadCount ) ;
97+
98+ if ( preloadCount < allowedPreloads ) {
99+ queue . shift ( ) ;
100+ preloadOne ( bundle ) ;
101+ } else {
102+ break ;
103+ }
94104 }
95105 }
96106 /**
0 commit comments