private async Task KeepLock() { try { while (!_cts.IsCancellationRequested) { try { await _lease.Renew(); await Task.Delay(TimeSpan.FromSeconds(30), _cts.Token); } catch (TaskCanceledException) { // Ignore } catch (Exception ex) { // Ignore Debug.Fail($"KeepLock failed: {ex}"); } } } catch (Exception ex) { // Ignore Debug.Fail($"KeepLock failed: {ex}"); } }
private async Task KeepLock() { var renewTime = TimeSpan.FromSeconds(15); try { while (!_cts.IsCancellationRequested) { try { await _lease.Renew(); await Task.Delay(renewTime, _cts.Token); } catch (TaskCanceledException) { // Ignore } catch (Exception ex) { // Ignore Log.LogWarning("Failed to renew lock on feed. If another client takes the lock conflicts could occur."); ExceptionUtilsSleetLib.LogException(ex, Log, LogLevel.Warning); } } // Exit lock // Make sure writing to the lock finished await _updateLockMessage; // Delete the message file await _messageBlob.DeleteIfExistsAsync(); } catch (Exception ex) { // Ignore Log.LogWarning("Unable to clear lock messsage"); ExceptionUtilsSleetLib.LogException(ex, Log, LogLevel.Warning); } }
private async Task KeepLock() { var renewTime = TimeSpan.FromSeconds(15); try { while (!_cts.IsCancellationRequested) { try { await _lease.Renew(); await Task.Delay(renewTime, _cts.Token); } catch (TaskCanceledException) { // Ignore } catch (Exception ex) { // Ignore Debug.Fail($"KeepLock failed: {ex}"); } } // Exit lock // Make sure writing to the lock finished await _updateLockMessage; // Delete the message file await _messageBlob.DeleteIfExistsAsync(); } catch (Exception ex) { // Ignore Debug.Fail($"KeepLock failed: {ex}"); } }