-
Notifications
You must be signed in to change notification settings - Fork 33
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
Don't delete response collectors in a transaction #369
Conversation
@@ -47,7 +47,7 @@ private ErrorMessage(String codePrefix, int codeNumber, String messagePrefix, St | |||
public static final Client MISSING_RESPONSE = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments on https://github.com/vaticle/typedb-client-python/pull/250/files, which this PR is a copy of.
@@ -518,6 +521,23 @@ public void testSimpleExplanation() { | |||
}, READ, TypeDBOptions.core().infer(true).explain(true)); | |||
} | |||
|
|||
@Test | |||
public void testStreaming() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these options (the default in TypeDB at time of writing), the server may respond with: 50 answers -> CONTINUE -> 1 answer [compensating for latency] -> DONE. The client will respond to CONTINUE with STREAM to keep iterating, and the server responds to STREAM with a 2nd DONE message.
This is expected and should be handled correctly (ie: ignored) by the client.
@@ -60,7 +60,6 @@ private boolean fetchAndCheck() { | |||
case STREAM_RES_PART: | |||
switch (resPart.getStreamResPart().getState()) { | |||
case DONE: | |||
stream.iteratorDone(requestID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need the bidirectional stream in this class at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm!!
What is the goal of this PR?
We no longer delete response collectors in a transaction after receiving a response to a "single" request, or receiving a "DONE" message in a stream. This fixes a possible error when loading 50+ answers in one query and then performing a second query.
What are the changes implemented in this PR?
See typedb/typedb-driver-python#250, which this PR is a copy of.