@@ -192,13 +192,12 @@ module.exports.test = {
192192 submittedData ( dataFile ) {
193193 return function ( key ) {
194194 if ( ! fs . existsSync ( dataFile ) ) {
195- // Increase wait time for CI environments where form submission may be slower
196- const waitTime = process . env . CI ? 45 * 1000 : 1 * 1000 // 45 seconds in CI, 1 second otherwise
197- const pollInterval = 500 // Check every 500ms to reduce load
195+ // Reduce wait time while maintaining reliability across different environments
196+ const waitTime = process . env . CI ? 30 * 1000 : 1 * 1000 // 30 seconds in CI, 1 second otherwise
197+ const pollInterval = 250 // Check every 250ms for faster detection
198198 const startTime = new Date ( ) . getTime ( )
199199
200- // Poll for file existence with exponential backoff-style intervals
201- let currentInterval = pollInterval
200+ // Poll for file existence with optimized intervals
202201 while ( new Date ( ) . getTime ( ) - startTime < waitTime ) {
203202 if ( fs . existsSync ( dataFile ) ) {
204203 break
@@ -208,24 +207,21 @@ module.exports.test = {
208207 try {
209208 if ( os . platform ( ) === 'win32' ) {
210209 // Use timeout command which is more reliable than ping
211- spawnSync ( 'timeout' , [ '/t' , Math . ceil ( currentInterval / 1000 ) . toString ( ) ] , { stdio : 'ignore' } )
210+ spawnSync ( 'timeout' , [ '/t' , '1' ] , { stdio : 'ignore' } )
212211 } else {
213212 // Use sleep with fractional seconds for better precision
214- spawnSync ( 'sleep' , [ ( currentInterval / 1000 ) . toString ( ) ] , { stdio : 'ignore' } )
213+ spawnSync ( 'sleep' , [ ( pollInterval / 1000 ) . toString ( ) ] , { stdio : 'ignore' } )
215214 }
216215 } catch ( err ) {
217216 // Fallback to setTimeout-based delay if system commands fail
218- const end = new Date ( ) . getTime ( ) + currentInterval
217+ const end = new Date ( ) . getTime ( ) + pollInterval
219218 while ( new Date ( ) . getTime ( ) < end ) {
220219 // Small yield to prevent complete CPU lock
221220 if ( new Date ( ) . getTime ( ) % 10 === 0 ) {
222221 process . nextTick ( ( ) => { } )
223222 }
224223 }
225224 }
226-
227- // Gradually increase interval to reduce polling frequency over time
228- currentInterval = Math . min ( currentInterval * 1.2 , 2000 )
229225 }
230226 }
231227 if ( ! fs . existsSync ( dataFile ) ) {
0 commit comments