Skip to content

Commit fd3e752

Browse files
committed
#197 shortened LoggerRepositorySkeleton.GetWaitTime
1 parent 36ea5b4 commit fd3e752

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/log4net/Repository/LoggerRepositorySkeleton.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,6 @@ protected virtual void OnConfigurationReset(EventArgs? e)
453453
/// Notify the registered listeners that the repository has had its configuration changed
454454
/// </summary>
455455
/// <param name="e">Empty EventArgs</param>
456-
/// <remarks>
457-
/// <para>
458-
/// Notify any listeners that this repository's configuration has changed.
459-
/// </para>
460-
/// </remarks>
461456
protected virtual void OnConfigurationChanged(EventArgs? e)
462457
=> ConfigurationChanged?.Invoke(this, e ?? EventArgs.Empty);
463458

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

476471
private static int GetWaitTime(DateTime startTimeUtc, int millisecondsTimeout)
477472
{
478-
if (millisecondsTimeout == Timeout.Infinite)
479-
{
480-
return Timeout.Infinite;
481-
}
482-
if (millisecondsTimeout == 0)
473+
if (millisecondsTimeout is 0 or Timeout.Infinite)
483474
{
484-
return 0;
475+
return millisecondsTimeout;
485476
}
486477

487478
int elapsedMilliseconds = (int)(DateTime.UtcNow - startTimeUtc).TotalMilliseconds;
488479
int timeout = millisecondsTimeout - elapsedMilliseconds;
489-
return (timeout < 0) ? 0 : timeout;
480+
return Math.Max(0, timeout);
490481
}
491482

492483
/// <summary>

0 commit comments

Comments
 (0)