public void SynchronizeDataTestMethod() { Logger logger = LogManager.GetCurrentClassLogger(); try { ProjectOnlineSystemConnectorHubHelper.StartHubConnection(ConfigurationManager.AppSettings["SignalRHostUrl"]); publishMax = int.Parse(ConfigurationManager.AppSettings["PublishMax"]); stagingRecordLifeTime = int.Parse(ConfigurationManager.AppSettings["StagingRecordLifeTime"]); projectsPerIteration = int.Parse(ConfigurationManager.AppSettings["ProjectsPerIteration"]); InitProjectOnlineAccessService(); using (var unitOfWork = new UnitOfWork()) { Guid winServiceIterationUid = Guid.NewGuid(); dbToProjectOnlineSync = new DbToProjectOnlineSync(unitOfWork, projectOnlineODataService, publishMax, stagingRecordLifeTime, projectsPerIteration, winServiceIterationUid); dbToProjectOnlineSync.SynchronizeData(null); } } catch (Exception exception) { logger.Error(exception); } }
private void OnTimerJiraTick(object state) { TimeSpan timeElapsed = DateTime.Now - lastCleanCache; logger.Info($"OnTimerJiraTick START lastCleanCache: {lastCleanCache}; " + $"timeElapsed.TotalMilliseconds: {timeElapsed.TotalMilliseconds}"); if (Monitor.TryEnter(lockObjectJira)) { try { if (timeElapsed.TotalMilliseconds >= periodCleanCache || ProjectOnlineCache.NeedInitCache()) { projectOnlineAccessService.ClearCache(); projectOnlineAccessService.InitCache(); projectOnlineODataService.ClearCache(); projectOnlineODataService.InitCache(); lastCleanCache = DateTime.Now; } using (var unitOfWork = new UnitOfWork()) { Guid winServiceIterationUid = Guid.NewGuid(); dbToProjectOnlineSync = new DbToProjectOnlineSync(unitOfWork, projectOnlineODataService, publishMax, stagingRecordLifeTime, projectsPerIteration, winServiceIterationUid); dbToProjectOnlineSync.SynchronizeData(state); } } catch (Exception exception) { logger.Fatal(exception); } finally { Monitor.Exit(lockObjectJira); } } logger.Info("OnTimerJiraTick END"); }