-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[#397]: Preserve the order of the response messages when the stream response process handles ":consume_response" #396
[#397]: Preserve the order of the response messages when the stream response process handles ":consume_response" #396
Conversation
@@ -100,7 +100,7 @@ defmodule GRPC.Client.Adapters.Mint.StreamResponseProcess do | |||
{{_, message}, rest} -> | |||
# TODO add code here to handle compressor headers | |||
response = codec.decode(message, res_mod) | |||
new_responses = [{:ok, response} | responses] | |||
new_responses = responses ++ [{:ok, 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.
Instead of using a list, let's change the data structure to a queue: https://www.erlang.org/doc/apps/stdlib/queue.html
Erlang :queue is supposed to be O(1) for enqueueing and dequeueing. This change is O(len(responses))
for enqueueing
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.
Good point, migrated to erlang queue
Fixes /issues/397