Esempio n. 1
0
        private void StartStream()
        {
            _log.Debug("Starting push mode...");

            _synchronizer.StartPeriodicDataRecording();
            _synchronizer.SyncAll();
            Task.Factory.StartNew(() => _pushManager.StartSse());
        }
Esempio n. 2
0
        public void SyncAll_ShouldStartFetchSplitsAndSegments()
        {
            // Act.
            _synchronizer.SyncAll();

            // Assert.
            _splitFetcher.Verify(mock => mock.FetchSplits(), Times.Once);
            _segmentFetcher.Verify(mock => mock.FetchAll(), Times.Once);
        }
Esempio n. 3
0
        public void Start()
        {
            _tasksManager.Start(() =>
            {
                try
                {
                    while (!_synchronizer.SyncAll(_shutdownCancellationTokenSource, asynchronous: false))
                    {
                        _wrapperAdapter.TaskDelay(500).Wait();
                    }

                    _statusManager.SetReady();
                    _telemetrySyncTask.RecordConfigInit();
                    _synchronizer.StartPeriodicDataRecording();

                    if (_streamingEnabled)
                    {
                        _log.Debug("Starting streaming mode...");
                        var connected = _pushManager.StartSse().Result;

                        if (connected)
                        {
                            return;
                        }
                    }

                    _log.Debug("Starting polling mode ...");
                    _synchronizer.StartPeriodicFetching();
                    _telemetryRuntimeProducer.RecordStreamingEvent(new StreamingEvent(EventTypeEnum.SyncMode, (int)SyncModeEnum.Polling));
                }
                catch (Exception ex)
                {
                    _log.Debug("Exception initialization SDK.", ex);
                }
            }, _shutdownCancellationTokenSource, "SDK Initialization");
        }
Esempio n. 4
0
        public void SyncAll_ShouldStartFetchSplitsAndSegments()
        {
            // Act.
            _splitFetcher
            .Setup(mock => mock.FetchSplits(It.IsAny <FetchOptions>()))
            .ReturnsAsync(new FetchResult {
                Success = true
            });

            _synchronizer.SyncAll(new CancellationTokenSource());

            // Assert.
            Thread.Sleep(2000);
            _splitFetcher.Verify(mock => mock.FetchSplits(It.IsAny <FetchOptions>()), Times.Once);
            _segmentFetcher.Verify(mock => mock.FetchAll(), Times.Once);
        }