-
Notifications
You must be signed in to change notification settings - Fork 177
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
[Access] Change SendAndSubscribe endpoint's MessageIndex to start at 0 #6598
base: master
Are you sure you want to change the base?
[Access] Change SendAndSubscribe endpoint's MessageIndex to start at 0 #6598
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6598 +/- ##
==========================================
- Coverage 41.19% 41.19% -0.01%
==========================================
Files 2052 2052
Lines 182191 182200 +9
==========================================
+ Hits 75062 75065 +3
+ Misses 100839 100838 -1
- Partials 6290 6297 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…ex-start-with-zero
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.
This also fixed the same issue for Accounts and Events. I know this is out of scope, but could you please also check MessageIndex for blocks to see if the implementation in all subscriptions is consistent?
Other than that, looks good to me.
…-send-and-subscribe-endoints-msg-index-start-with-zero
…-zero' of github.com:AndriiDiachuk/flow-go into change-send-and-subscribe-endoints-msg-index-start-with-zero
…ex-start-with-zero
@@ -381,7 +381,7 @@ func (h *Handler) handleEventsResponse(send sendSubscribeEventsResponseFunc, hea | |||
return status.Errorf(codes.Internal, "could not convert events to entity: %v", err) | |||
} | |||
|
|||
index := messageIndex.Increment() | |||
index := messageIndex.Value() |
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.
nit: keep the get and set together so the stream fails quickly if there's an issue
index := messageIndex.Value() | |
index := messageIndex.Value() | |
if ok := messageIndex.Set(index + 1); !ok { | |
return status.Errorf(codes.Internal, "message index already incremented to %d", messageIndex.Value()) | |
} |
@@ -495,7 +499,7 @@ func (h *Handler) handleAccountStatusesResponse( | |||
return err | |||
} | |||
|
|||
index := messageIndex.Increment() | |||
index := messageIndex.Value() |
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.
same here
@@ -1435,15 +1435,19 @@ func (h *Handler) SendAndSubscribeTransactionStatuses( | |||
messageIndex := counters.NewMonotonousCounter(0) | |||
return subscription.HandleSubscription(sub, func(txResults []*TransactionResult) error { | |||
for i := range txResults { | |||
value := messageIndex.Increment() | |||
index := messageIndex.Value() |
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.
and here
Closes: #6575
Related PR: onflow/flow#1520