/// <summary> /// /// </summary> /// <returns></returns> public TaskResult Do(TransactionParameter transactionParameter) { var isBackOfficeException = false; var sleepInterval = 5; while (true) { if (isBackOfficeException) { Logger.Info($"Performing sleep for {sleepInterval} minutes"); Thread.Sleep(TimeSpan.FromMinutes(sleepInterval)); sleepInterval *= 2; Logger.Info("awoken from sleep"); } var batch = new List <Import> { new Import { Symbol = transactionParameter.Symbol } }; var taskResult = _taskActor.Do(batch, transactionParameter); Logger.Info($"Thread id: {_taskActor.TaskInstance.Id} will processing the following symbols: { transactionParameter.Symbol }"); _taskProcessor.AddTask(_taskActor); isBackOfficeException = _taskProcessor .Process() .IsSuccessful.Value; if (taskResult.IsSuccessful.Value) { break; } } _taskActor.Dispose(); var importTracker = _importTrackerRepository .GetAll() .GetData <List <ImportTracker> >() .ToList() .First(x => x.Equals(new ImportTracker(transactionParameter.Symbol))); importTracker.Status = "Success"; _importTrackerRepository.PutAsync(importTracker); return(new TaskResult { IsSuccessful = true }); }
private void Client_OnCoinBalanceRequest(HClient arg1, string obj) { TaskProcessor.AddTask(new HTask(HTask.HTaskType.CoinBalance_Process, arg1, obj)); }
private void Client_OnTowerDataRequest(object sender, TowerDataRequstArgs e) { TaskProcessor.AddTask(new HTask(HTask.HTaskType.TowerData_Fetch, (HClient)sender, e)); }
private void Client_OnTutorialData(HClient arg1, ulong arg2, string authString) { TaskProcessor.AddTask(new HTask(HTask.HTaskType.TutorialData_Store, arg1, arg2, authString)); }
private void Client_OnGameDataRequest(object sender, EventArgs e) { TaskProcessor.AddTask(new HTask(HTask.HTaskType.GameData_Fetch, (HClient)sender, null)); }