@@ -374,26 +374,29 @@ const createTrace2Monitor = Effect.fn(function* (
374374 const readTraceDelta = deltaMutex . withPermit (
375375 fs . readFileString ( traceFilePath ) . pipe (
376376 Effect . flatMap ( ( contents ) =>
377- Ref . modify ( traceTailState , ( { processedChars, remainder } ) => {
378- if ( contents . length <= processedChars ) {
379- return [ [ ] , { processedChars, remainder } ] ;
380- }
377+ Effect . uninterruptible (
378+ Ref . modify ( traceTailState , ( { processedChars, remainder } ) => {
379+ if ( contents . length <= processedChars ) {
380+ return [ [ ] , { processedChars, remainder } ] ;
381+ }
381382
382- const appended = contents . slice ( processedChars ) ;
383- const combined = remainder + appended ;
384- const lines = combined . split ( "\n" ) ;
385- const nextRemainder = lines . pop ( ) ?? "" ;
386-
387- return [
388- lines . map ( ( line ) => line . replace ( / \r $ / , "" ) ) ,
389- {
390- processedChars : contents . length ,
391- remainder : nextRemainder ,
392- } ,
393- ] ;
394- } ) ,
383+ const appended = contents . slice ( processedChars ) ;
384+ const combined = remainder + appended ;
385+ const lines = combined . split ( "\n" ) ;
386+ const nextRemainder = lines . pop ( ) ?? "" ;
387+
388+ return [
389+ lines . map ( ( line ) => line . replace ( / \r $ / , "" ) ) ,
390+ {
391+ processedChars : contents . length ,
392+ remainder : nextRemainder ,
393+ } ,
394+ ] ;
395+ } ) . pipe (
396+ Effect . flatMap ( ( lines ) => Effect . forEach ( lines , handleTraceLine , { discard : true } ) ) ,
397+ ) ,
398+ ) ,
395399 ) ,
396- Effect . flatMap ( ( lines ) => Effect . forEach ( lines , handleTraceLine , { discard : true } ) ) ,
397400 Effect . ignore ( { log : true } ) ,
398401 ) ,
399402 ) ;
0 commit comments