예제 #1
0
        public async Task SubscriptionWorkerShouldNotFailoverToErroredNodes()
        {
            var cluster = await CreateRaftCluster(numberOfNodes : 3);

            using (var store = GetDocumentStore(new Options
            {
                ReplicationFactor = 3,
                Server = cluster.Leader,
                DeleteDatabaseOnDispose = false
            }))
            {
                Servers.ForEach(x => x.ForTestingPurposesOnly().GatherVerboseDatabaseDisposeInformation = true);

                var mre = new AsyncManualResetEvent();
                using (var subscriptionManager = new DocumentSubscriptions(store))
                {
                    var reqEx = store.GetRequestExecutor();
                    var name  = subscriptionManager.Create(new SubscriptionCreationOptions <User>());

                    var subs = await SubscriptionFailoverWithWaitingChains.GetSubscription(name, store.Database, cluster.Nodes);

                    Assert.NotNull(subs);
                    await Cluster.WaitForRaftIndexToBeAppliedOnClusterNodesAsync(subs.SubscriptionId, cluster.Nodes);

                    await ActionWithLeader(async l => await WaitForResponsibleNode(l.ServerStore, store.Database, name, toBecomeNull: false));

                    Assert.True(WaitForValue(() => reqEx.Topology != null, true));
                    var topology    = reqEx.Topology;
                    var serverNode1 = topology.Nodes[0];
                    await reqEx.UpdateTopologyAsync(new RequestExecutor.UpdateTopologyParameters(serverNode1)
                    {
                        TimeoutInMs = 10_000
                    });
예제 #2
0
        public async Task ShouldWork()
        {
            using (var store = GetDocumentStore())
            {
                var task = Task.Run(async() =>
                {
                    await SubscriptionFailoverWithWaitingChains.ContinuouslyGenerateDocs(10, store);
                });

                await Task.Delay(5555);
            }
        }
예제 #3
0
        public async Task ShouldWork()
        {
            using (var store = GetDocumentStore())
            {
                var task = Task.Run(async() =>
                {
                    while (false == store.WasDisposed)
                    {
                        await SubscriptionFailoverWithWaitingChains.ContinuouslyGenerateDocsInternal(10, store);
                    }
                });

                await Task.Delay(5555);
            }
        }
예제 #4
0
        public async Task ShouldWork()
        {
            using (var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5)))
                using (var store = GetDocumentStore())
                {
                    _ = Task.Run(async() =>
                    {
                        while (false == store.WasDisposed)
                        {
                            cts.Token.ThrowIfCancellationRequested();

                            await SubscriptionFailoverWithWaitingChains.ContinuouslyGenerateDocsInternal(10, store, cts.Token);
                        }
                    }, cts.Token);

                    await Task.Delay(5555, cts.Token);
                }
        }