예제 #1
0
        private async Task <IReadOnlyCollection <ReindexJobWrapper> > AcquireReindexJobsAsync(
            ushort maximumNumberOfConcurrentJobAllowed = 1,
            TimeSpan?jobHeartbeatTimeoutThreshold      = null)
        {
            if (jobHeartbeatTimeoutThreshold == null)
            {
                jobHeartbeatTimeoutThreshold = TimeSpan.FromMinutes(1);
            }

            return(await _operationDataStore.AcquireReindexJobsAsync(
                       maximumNumberOfConcurrentJobAllowed,
                       jobHeartbeatTimeoutThreshold.Value,
                       CancellationToken.None));
        }
        private void SetupOperationDataStore(
            ReindexJobWrapper job,
            ushort maximumNumberOfConcurrentJobsAllowed = DefaultMaximumNumberOfConcurrentJobAllowed,
            TimeSpan?jobHeartbeatTimeoutThreshold       = null,
            TimeSpan?jobPollingFrequency = null)
        {
            if (jobHeartbeatTimeoutThreshold == null)
            {
                jobHeartbeatTimeoutThreshold = DefaultJobHeartbeatTimeoutThreshold;
            }

            if (jobPollingFrequency == null)
            {
                jobPollingFrequency = DefaultJobPollingFrequency;
            }

            _fhirOperationDataStore.AcquireReindexJobsAsync(
                maximumNumberOfConcurrentJobsAllowed,
                jobHeartbeatTimeoutThreshold.Value,
                _cancellationToken)
            .Returns(new[] { job });
        }