File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -643,14 +643,18 @@ func (f *notifyFixture) consumeEventsInBackground(ctx context.Context) chan erro
643
643
}
644
644
645
645
func (f * notifyFixture ) fsync () {
646
+ f .fsyncWithRetryCount (3 )
647
+ }
648
+
649
+ func (f * notifyFixture ) fsyncWithRetryCount (retryCount int ) {
646
650
if len (f .paths ) == 0 {
647
651
return
648
652
}
649
653
650
654
syncPathBase := fmt .Sprintf ("sync-%d.txt" , time .Now ().UnixNano ())
651
655
syncPath := filepath .Join (f .paths [0 ], syncPathBase )
652
656
anySyncPath := filepath .Join (f .paths [0 ], "sync-" )
653
- timeout := time .After (time .Second )
657
+ timeout := time .After (250 * time .Millisecond )
654
658
655
659
f .WriteFile (syncPath , fmt .Sprintf ("%s" , time .Now ()))
656
660
677
681
f .events = append (f .events , event )
678
682
679
683
case <- timeout :
680
- f .T ().Fatalf ("fsync: timeout" )
684
+ if retryCount <= 0 {
685
+ f .T ().Fatalf ("fsync: timeout" )
686
+ } else {
687
+ f .fsyncWithRetryCount (retryCount - 1 )
688
+ }
689
+ return
681
690
}
682
691
}
683
692
}
You can’t perform that action at this time.
0 commit comments