Пример #1
0
 /// Caution!
 /// Every exception is being caught and ONLY logged
 /// avoiding from shutting down process
 private async Task SafeExecution()
 {
     try
     {
         for (int i = 0; i < _bgServiceOptions.Iterations; i++)
         {
             var fakeProduct = _generator.GenerateFakeProduct();
             await _smartStoreAdapter.StoreProduct(fakeProduct);
         }
         _logger.LogInformation($"--- Executed {nameof(SafeExecution)}, Stored {_bgServiceOptions.Iterations} products ---");
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
     }
 }