@@ -334,7 +334,8 @@ module.exports = (common) => {
334
334
335
335
describe ( 'load tests' , function ( ) {
336
336
// Write the progress to stdout when in Node.js, silent when in the browser
337
- const log = process && process . stdout ? ( s ) => process . stdout . write ( s ) : ( ) => { }
337
+ const LOGS = false
338
+ const log = LOGS && process && process . stdout ? ( s ) => process . stdout . write ( s ) : ( ) => { }
338
339
339
340
it ( 'send/receive 10k messages' , function ( done ) {
340
341
// js-ipfs is a little slow atm, so make sure we have enough time
@@ -368,23 +369,8 @@ module.exports = (common) => {
368
369
if ( receivedCount >= count ) {
369
370
const duration = new Date ( ) . getTime ( ) - startTime
370
371
log ( `Send/Receive 10k messages took: ${ duration } ms, ${ Math . floor ( count / ( duration / 1000 ) ) } ops / s\n` )
371
- subscription . cancel ( )
372
- . then ( ( ) => subscription2 . cancel ( ) )
373
- . then ( done )
374
- }
375
372
376
- // Check for early cancel.
377
- // We had bugs in the past where all 10k messages would be
378
- // buffered first and only then the receiving stream would
379
- // process them.
380
- // This check will make sure, that while the sending peer is
381
- // sending messages the receiving peer has started receiving
382
- // and processing them.
383
- if ( sendCount - ( count / 10 ) > receivedCount ) {
384
- sendCount = count
385
- subscription . cancel ( )
386
- . then ( ( ) => subscription2 . cancel ( ) )
387
- . then ( ( ) => done ( new Error ( `Didn't receive enough messages on time!` ) ) )
373
+ subscription . cancel ( ( ) => subscription2 . cancel ( done ) )
388
374
}
389
375
} )
390
376
0 commit comments