public async Task Update(CancellationToken cancellationToken) { var loopId = await _loopIdStore.GetOrCreateAsync(); Console.WriteLine($"Price update ID: {loopId}"); // Over time fetch all the apps that don't have the current "loop uuid" yet var apps = await GetNextAppsAsync(loopId); if (apps.Count == 0) { // Found no apps with a new ID -> refresh the ID and start anew in the next tick Console.WriteLine("Reached the end of price update"); await _loopIdStore.StoreAsync(_guidProvider.Create()); return; } var appsUpdated = await _appPricesUpdater.ProcessAppsAsync(apps, loopId, cancellationToken); await _appRepository.AddOrUpdateAppsAsync(appsUpdated, true, true); Console.WriteLine( $"Fetched the prices of the next {apps.Count} apps (app IDs {apps[0].Id} - {apps[^1].Id})");