Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -440,16 +440,17 @@ private bool TryCreatePublishConfiguration(out AzureDevOpsPublishConfiguration?
private bool ShouldFlushUnsafe(bool force)
{
int pendingResultsCount = _retryResults.Count + _pendingResults.Count;
if (force)
{
return pendingResultsCount > 0;
}

if (pendingResultsCount == 0)
{
return false;
}

if (force)
{
return true;
}

if (_clock.UtcNow - _lastFlushTime >= _options.FlushInterval)
{
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,18 @@ internal static bool TryParseTimeoutArgument(string arg, out TimeSpan timeout)
{
timeout = TimeSpan.Zero;

// We need at least one digit plus a unit suffix (e.g. "1s").
if (arg is null || arg.Length < 2)
{
return false;
}

char unit = char.ToLowerInvariant(arg[arg.Length - 1]);
if (unit is not 'h' and not 'm' and not 's')
char unit = char.ToLowerInvariant(arg[^1]);
if (unit is not ('h' or 'm' or 's'))
{
return false;
}

if (!float.TryParse(arg[..(arg.Length - 1)], NumberStyles.Float, CultureInfo.InvariantCulture, out float value)
if (!float.TryParse(arg[..^1], NumberStyles.Float, CultureInfo.InvariantCulture, out float value)
|| float.IsNaN(value)
|| float.IsInfinity(value)
|| value < 0)
Expand Down
Loading