protected virtual async Task RemoveDeviceCodesAsync() { for (var i = 0; i < Options.CleanupLoopCount; i++) { var deviceFlowCodeses = await DeviceFlowCodesRepository.GetListByExpirationAsync(DateTime.UtcNow, Options.CleanupBatchSize); await DeviceFlowCodesRepository.DeleteManyAsync(deviceFlowCodeses); //No need to continue to query if it gets more than max items. if (deviceFlowCodeses.Count < Options.CleanupBatchSize) { break; } } }
protected virtual async Task RemoveDeviceCodesAsync() { for (int i = 0; i < Options.CleanupLoopCount; i++) { var deviceFlowCodeses = await DeviceFlowCodesRepository .GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize); //TODO: Can be optimized if the repository implements the batch deletion foreach (var deviceFlowCodes in deviceFlowCodeses) { await DeviceFlowCodesRepository .DeleteAsync(deviceFlowCodes); } //No need to continue to query if it gets more than max items. if (deviceFlowCodeses.Count < Options.CleanupBatchSize) { break; } } }