Exemple #1
0
 public async Task <Person> GetPerson(int id)
 {
     try
     {
         return(await _wrappedReader.GetPerson(id));
     }
     catch (Exception ex)
     {
         _logger?.LogException(ex);
         throw;
     }
 }
 public Person GetPerson(int id)
 {
     try
     {
         return(_wrappedReader.GetPerson(id));
     }
     catch (Exception ex)
     {
         _logger?.LogException(ex);
         throw;
     }
 }
 public Person GetPerson(int id)
 {
     _retryCount++;
     try
     {
         var person = _wrappedReader.GetPerson(id);
         _retryCount = 0;
         return(person);
     }
     catch (Exception)
     {
         if (_retryCount >= 3)
         {
             throw;
         }
         Thread.Sleep(_retryDelay);
         return(this.GetPerson(id));
     }
 }
Exemple #4
0
        public async Task <Person> GetPerson(int id)
        {
            _retryCount++;
            try
            {
                var person = await _wrappedReader.GetPerson(id);

                _retryCount = 0;
                return(person);
            }
            catch (Exception)
            {
                if (_retryCount >= 3)
                {
                    throw;
                }
                await Task.Delay(_retryDelay);

                return(await this.GetPerson(id));
            }
        }