File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -115,11 +115,16 @@ func ctxWithSplitTimeout(
115115 return context .WithTimeout (ctx , minTimeout )
116116 }
117117
118- timeout := time .Until (deadline ) / time . Duration ( splitFactor )
119- if minTimeout == 0 || timeout > minTimeout {
120- return context .WithTimeout (ctx , timeout )
118+ timeout := time .Until (deadline )
119+ if timeout < minTimeout {
120+ return context .WithCancel (ctx )
121121 }
122- return context .WithTimeout (ctx , minTimeout )
122+
123+ splitTimeout := timeout / time .Duration (splitFactor )
124+ if splitTimeout < minTimeout {
125+ return context .WithTimeout (ctx , minTimeout )
126+ }
127+ return context .WithTimeout (ctx , splitTimeout )
123128}
124129
125130// ErrorContains reports whether any error in err's tree matches any error in targets tree.
You can’t perform that action at this time.
0 commit comments