Exemple #1
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 #2
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;
            }
        }