public long ClearMessages(System.Threading.CancellationToken cancelToken)
{
var counter = _commandReset.Handle(new ClearExpiredMessagesCommand());
var total = counter;
while (counter > 0)
{
if (cancelToken.IsCancellationRequested)
return total;
counter = _commandReset.Handle(new ClearExpiredMessagesCommand());
total += counter;
}
return total;
}
}