Пример #1
0
        public async Task StartJob()
        {
            var appProperties = await _applicationPropertyDao.GetAsync();

            var startDate = appProperties?.LastMongoIndexing ?? DateTime.MinValue;

            await IndexAnswers(startDate);
            await IndexQuestions(startDate);

            await _applicationPropertyDao.UpsertPropertyAsync(app => app.LastMongoIndexing, DateTime.UtcNow);
        }
Пример #2
0
        public async Task StartJob()
        {
            var appProperties = await _applicationPropertyDao.GetAsync();

            var startDate = appProperties?.ConfluenceJobLastUpdate.ToLocalTime() ?? DateTime.MinValue;

            var response = await _confluenceHttpClient.GetLatestPagesAsync(_settings.Value.SpaceKeys, startDate);

            UploadBatch(response);

            while (response.Links?.Next != null)
            {
                var nextBatchQuery = response.Links.Next;
                response = await _confluenceHttpClient.GetNextBatchAsync(nextBatchQuery);

                UploadBatch(response);
            }
        }
Пример #3
0
        public async Task StartJob()
        {
            var appProperties = await _applicationPropertyDao.GetAsync();

            var loadFromDate       = appProperties?.JiraJobLastUpdate ?? DateTime.MinValue;
            var loadFromDateLocal  = loadFromDate.ToLocalTime();
            var isAllIssuesUpdated = false;
            var startAt            = 0;

            while (!isAllIssuesUpdated)
            {
                var jiraResponse = await _jiraClient.GetLatestIssuesAsync(_settings.Value.ProjectNames, loadFromDateLocal, _settings.Value.BatchSize, startAt);

                await UploadIssuesBatch(jiraResponse);

                var lastIssueDateTimeUpdated = jiraResponse.Last().Updated;
                if (lastIssueDateTimeUpdated.HasValue)
                {
                    var loadFromDateTimeLocalFormat    = loadFromDateLocal.ToString(TimeFormat, CultureInfo.InvariantCulture);
                    var lastIssueDateTimeUpdatedFormat = lastIssueDateTimeUpdated.Value.ToString(TimeFormat, CultureInfo.InvariantCulture);

                    if (loadFromDateTimeLocalFormat == lastIssueDateTimeUpdatedFormat)
                    {
                        startAt += _settings.Value.BatchSize;
                    }
                    else
                    {
                        startAt           = 0;
                        loadFromDateLocal = lastIssueDateTimeUpdated.Value;
                    }

                    await _applicationPropertyDao.UpsertPropertyAsync(p => p.JiraJobLastUpdate, loadFromDateLocal.ToUniversalTime());
                }

                isAllIssuesUpdated = jiraResponse.TotalItems == jiraResponse.Count();
            }
        }