예제 #1
0
        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}");
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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}");
            }
        }