Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When With() called on ICompletes server end than the client can't chain continuation #55

Open
tjaskula opened this issue Mar 11, 2020 · 0 comments
Labels
Completes under investigation needs to be investigated further

Comments

@tjaskula
Copy link
Contributor

tjaskula commented Mar 11, 2020

This can be demonstrated with the following test

[Fact]
        public void TestOnClientAndServerSetupWhenServerIsFaster()
        {
            var ints = new List<int>();
            var completeInteger = NewEmptyCompletes<int>();
            var expected = Enumerable.Range(0, 1000).ToList();

            var server = new Thread(() => expected.ForEach(i => completeInteger.With(i)));
            var client = new Thread(() => completeInteger.AndThen(i =>
            {
                ints.Add(i);
                return i;
            }).Repeat());
            
            server.Start();
            Thread.Sleep(10);
            client.Start();

            server.Join();
            client.Join();

            var intHashSet = new HashSet<int>(ints);
            var expectedHashSet = new HashSet<int>(expected);

            expectedHashSet.RemoveWhere(h => intHashSet.Contains(h));
            Assert.Empty(expectedHashSet);
        }

As you can see client is late by 10ms with processing. Attaching a continuation is too late because the server has already processed the continuation on its end.

On the JVM this is supported by the SinkAndSourceBasedCompletes but needs to be run agains the regular implementation of BasicCompletes in order to confirm that both has the same behavior.

@tjaskula tjaskula added bug Something isn't working under investigation needs to be investigated further and removed bug Something isn't working labels Mar 11, 2020
tjaskula added a commit that referenced this issue Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Completes under investigation needs to be investigated further
Projects
None yet
Development

No branches or pull requests

1 participant