private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { // read data from the cloud, // based on data from the cloud, write back to the cloud // mark the command as processed in the database await ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { // read data from the cloud, // based on data from the cloud, write back to the cloud // mark the command as processed in the database ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { // read data from the cloud, // based on data from the cloud, write back to the cloud // mark the command as processed in the database await ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { await // read data from the cloud, // based on data from the cloud, write back to the cloud // mark the command as processed in the database ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { await ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { // read data from the cloud, // based on data from the cloud, write back to the cloud // mark the command as processed in the database ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { await ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { await ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } private readonly SemaphoreSlim _mutex = new SemaphoreSlim(1); public async Task ProcessPostedCommandsAsync() { using (var showContext = new ShowContext()) { var retryCnt = 0; var maxRetries = 8; var commands = FindCommands(showContext); foreach (var command in commands) { await _mutex.WaitAsync(); try { await ProcessCommandAsync(showContext, command); } catch (Exception e) { GlobalLogger.Logger.Error(e, $"assinging executing task, Exception in Process Commands pkid = {command.Pkid} "); GlobalLogger.Logger.Error($"Retry count = {retryCnt}"); retryCnt++; await Task.Delay(2000); if (retryCnt == maxRetries) { break; // from for } } finally { _mutex.Release(); } } } } Loading
lang-cs