mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-29 13:52:08 +02:00
@@ -162,10 +162,9 @@ namespace WireMock.Owin
|
|||||||
|
|
||||||
if (_options.MaxRequestLogCount != null)
|
if (_options.MaxRequestLogCount != null)
|
||||||
{
|
{
|
||||||
var amount = _options.LogEntries.Count - _options.MaxRequestLogCount.Value;
|
foreach (var logEntry in _options.LogEntries.OrderBy(le => le.RequestMessage.DateTime).Take(_options.LogEntries.Count - _options.MaxRequestLogCount.Value).ToList())
|
||||||
for (int i = 0; i < amount; i++)
|
|
||||||
{
|
{
|
||||||
_options.LogEntries.RemoveAt(0);
|
_options.LogEntries.Remove(logEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,13 +172,9 @@ namespace WireMock.Owin
|
|||||||
{
|
{
|
||||||
var checkTime = DateTime.UtcNow.AddHours(-_options.RequestLogExpirationDuration.Value);
|
var checkTime = DateTime.UtcNow.AddHours(-_options.RequestLogExpirationDuration.Value);
|
||||||
|
|
||||||
for (var i = _options.LogEntries.Count - 1; i >= 0; i--)
|
foreach (var logEntry in _options.LogEntries.Where(le => le.RequestMessage.DateTime < checkTime).ToList())
|
||||||
{
|
{
|
||||||
var le = _options.LogEntries[i];
|
_options.LogEntries.Remove(logEntry);
|
||||||
if (le.RequestMessage.DateTime <= checkTime)
|
|
||||||
{
|
|
||||||
_options.LogEntries.RemoveAt(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user