Skip to content

Commit

Permalink
#197 shortened LoggerRepositorySkeleton.GetWaitTime
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeAndNil committed Oct 18, 2024
1 parent 36ea5b4 commit fd3e752
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/log4net/Repository/LoggerRepositorySkeleton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,6 @@ protected virtual void OnConfigurationReset(EventArgs? e)
/// Notify the registered listeners that the repository has had its configuration changed
/// </summary>
/// <param name="e">Empty EventArgs</param>
/// <remarks>
/// <para>
/// Notify any listeners that this repository's configuration has changed.
/// </para>
/// </remarks>
protected virtual void OnConfigurationChanged(EventArgs? e)
=> ConfigurationChanged?.Invoke(this, e ?? EventArgs.Empty);

Expand All @@ -475,18 +470,14 @@ protected virtual void OnConfigurationChanged(EventArgs? e)

private static int GetWaitTime(DateTime startTimeUtc, int millisecondsTimeout)
{
if (millisecondsTimeout == Timeout.Infinite)
{
return Timeout.Infinite;
}
if (millisecondsTimeout == 0)
if (millisecondsTimeout is 0 or Timeout.Infinite)
{
return 0;
return millisecondsTimeout;
}

int elapsedMilliseconds = (int)(DateTime.UtcNow - startTimeUtc).TotalMilliseconds;
int timeout = millisecondsTimeout - elapsedMilliseconds;
return (timeout < 0) ? 0 : timeout;
return Math.Max(0, timeout);
}

/// <summary>
Expand Down

0 comments on commit fd3e752

Please sign in to comment.