internal GitDataUpdater(
            IMergeRequestCache mergeRequestCache,
            IDiscussionCache discussionCache,
            ISynchronizeInvoke synchronizeInvoke,
            ILocalCommitStorageFactory gitFactory,
            int autoUpdatePeriodMs,
            MergeRequestFilter mergeRequestFilter,
            bool isInitialUpdateNeeded)
            : base(mergeRequestCache, discussionCache, synchronizeInvoke, gitFactory)
        {
            if (autoUpdatePeriodMs < 1)
            {
                throw new ArgumentException("Bad auto-update period specified");
            }
            _mergeRequestFilter = mergeRequestFilter;

            _timer = new System.Timers.Timer {
                Interval = autoUpdatePeriodMs
            };
            _timer.Elapsed            += onTimer;
            _timer.SynchronizingObject = synchronizeInvoke;
            _timer.Start();

            if (isInitialUpdateNeeded)
            {
                scheduleAllProjectsUpdate();
            }
        }
Example #2
0
 internal GitBasedDiffStatProvider(
     IMergeRequestCache mergeRequestCache,
     IDiscussionCache discussionCache,
     ISynchronizeInvoke synchronizeInvoke,
     ILocalCommitStorageFactory gitFactory)
     : base(mergeRequestCache, discussionCache, synchronizeInvoke, gitFactory)
 {
     scheduleAllProjectsUpdate();
 }
Example #3
0
        internal BaseGitHelper(
            IMergeRequestCache mergeRequestCache,
            IDiscussionCache discussionCache,
            ISynchronizeInvoke synchronizeInvoke,
            ILocalCommitStorageFactory gitFactory)
        {
            _mergeRequestCache = mergeRequestCache;
            _mergeRequestCache.MergeRequestEvent += onMergeRequestEvent;

            _discussionCache = discussionCache;

            _gitFactory = gitFactory;
            if (_gitFactory != null)
            {
                _gitFactory.GitRepositoryCloned += onGitRepositoryCloned;
            }
            _synchronizeInvoke = synchronizeInvoke;
        }
Example #4
0
        async internal static Task <string> GetLatestSpecialNote(IDiscussionCache discussionCache, MergeRequestKey mrk)
        {
            IEnumerable <Discussion> discussions = null;

            try
            {
                discussions = await discussionCache.LoadDiscussions(mrk);
            }
            catch (DiscussionCacheException ex)
            {
                ExceptionHandlers.Handle("Could not load Discussions", ex);
                return(String.Empty);
            }

            Discussion note = discussions?
                              .Where(x => x.Notes != null &&
                                     x.Notes.Count() == 1 &&
                                     x.Notes.First().Body.StartsWith(Program.ServiceManager.GetSpecialNotePrefix()))
                              .LastOrDefault();

            return(note?.Notes.First().Body);
        }