private async Task RunAndRescheduleNoThrow()
        {
            try
            {
                var logger = new SynchronizationLogger(_profileId, _profileName);

                using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Running synchronization profile '{0}'", _profileName)))
                {
                    await _synchronizer.SynchronizeNoThrow(logger);
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                var synchronizationReport = logger.GetReport();
                _synchronizationReportRepository.AddReport(synchronizationReport);
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.HandleException(x, s_logger);
            }
            finally
            {
                _lastRun = DateTime.UtcNow;
            }
        }
        private async Task RunPartialNoThrow(IOutlookId[] itemsToSync)
        {
            try
            {
                using (var logger = new SynchronizationLogger(_profileId, _profile.ProfileName, _reportSink, _profile.IncludeEntityReportsWithoutErrorsOrWarnings))
                {
                    using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Partial sync: Running synchronization profile '{0}'", _profile.ProfileName)))
                    {
                        try
                        {
                            await _profile.Synchronizer.SynchronizePartial(itemsToSync, logger);
                        }
                        catch (Exception x)
                        {
                            _errorHandlingStrategy.HandleException(x, logger);
                        }
                    }

                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
            catch (Exception x)
            {
                s_logger.Error(null, x);
            }
        }
        private async Task RunAndRescheduleNoThrow()
        {
            try
            {
                using (var logger = new SynchronizationLogger(_profileId, _profile.ProfileName, _reportSink, _profile.IncludeEntityReportsWithoutErrorsOrWarnings))
                {
                    using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Running synchronization profile '{0}'", _profile.ProfileName)))
                    {
                        try
                        {
                            await _profile.Synchronizer.Synchronize(logger);
                        }
                        catch (Exception x)
                        {
                            _errorHandlingStrategy.HandleException(x, logger);
                        }
                    }

                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
            catch (Exception x)
            {
                s_logger.Error(null, x);
            }
            finally
            {
                _lastRun = _dateTimeProvider.Now;
            }
        }
Exemple #4
0
        private async Task RunPartialNoThrow(IOutlookId[] itemsToSync)
        {
            try
            {
                using (var logger = new SynchronizationLogger(_profileId, _profileName, _reportSink))
                {
                    using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Partial sync: Running synchronization profile '{0}'", _profileName)))
                    {
                        try
                        {
                            await _synchronizer.SynchronizePartial(itemsToSync, logger);
                        }
                        catch (Exception x)
                        {
                            logger.LogAbortedDueToError(x);
                            ExceptionHandler.Instance.LogException(x, s_logger);
                        }
                    }

                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
            catch (Exception x)
            {
                s_logger.Error(null, x);
            }
        }
Exemple #5
0
        private async Task RunAndRescheduleNoThrow()
        {
            try
            {
                using (var logger = new SynchronizationLogger(_profileId, _profileName, _reportSink))
                {
                    using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Running synchronization profile '{0}'", _profileName)))
                    {
                        try
                        {
                            await _synchronizer.Synchronize(logger);
                        }
                        catch (Exception x)
                        {
                            logger.LogAbortedDueToError(x);
                            ExceptionHandler.Instance.LogException(x, s_logger);
                        }
                    }

                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                }
            }
            catch (Exception x)
            {
                s_logger.Error(null, x);
            }
            finally
            {
                _lastRun = DateTime.UtcNow;
            }
        }
        public async Task <SynchronizationReport> Synchronize()
        {
            var reportSink = new TestReportSink();

            using (var logger = new SynchronizationLogger(Options.Id, Options.Name, reportSink))
            {
                await Synchronizer.Synchronize(logger);
            }

            return(reportSink.SynchronizationReport);
        }
Exemple #7
0
        public async Task <SynchronizationReport> Synchronize()
        {
            var reportSink = new TestReportSink();

            using (var logger = new SynchronizationLogger(Options.Id, Options.Name, reportSink, TestComponentContainer.GeneralOptions.IncludeEntityReportsWithoutErrorsOrWarnings))
            {
                await Synchronizer.Synchronize(logger);
            }

            return(reportSink.SynchronizationReport);
        }
        private async Task RunIfResponsibleNoThrow(IEnumerable <string> itemsToSync)
        {
            try
            {
                var logger = new SynchronizationLogger(_profileId, _profileName);

                using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Running synchronization profile '{0}'", _profileName)))
                {
                    await _synchronizer.SnychronizePartialNoThrow(itemsToSync, logger);
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                var synchronizationReport = logger.GetReport();
                _synchronizationReportRepository.AddReport(synchronizationReport);
            }
            catch (Exception x)
            {
                ExceptionHandler.Instance.HandleException(x, s_logger);
            }
        }
        private async Task RunPartialNoThrow(IIdWithHints <string, DateTime>[] itemsToSync)
        {
            try
            {
                var logger = new SynchronizationLogger(_profileId, _profileName);

                using (AutomaticStopwatch.StartInfo(s_logger, string.Format("Partial sync: Running synchronization profile '{0}'", _profileName)))
                {
                    await _synchronizer.SnychronizePartialNoThrow(itemsToSync, logger);
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                var synchronizationReport = logger.GetReport();
                _reportSink.PostReport(synchronizationReport);
            }
            catch (Exception x)
            {
                s_logger.Error(null, x);
            }
        }