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

[Access] Pending status returns immediately from send and subscribe transaction statuses #6737

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

Guitarheroua
Copy link
Contributor

@Guitarheroua Guitarheroua commented Nov 19, 2024

Closes #6573, part of #6767

This PR implements functionality to return a Pending status immediately upon the start of a subscription.

@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 32.50000% with 81 lines in your changes missing coverage. Please review.

Project coverage is 40.99%. Comparing base (45950a7) to head (80b63eb).

Files with missing lines Patch % Lines
access/mock/api.go 0.00% 44 Missing ⚠️
.../access/rpc/backend/backend_stream_transactions.go 56.71% 24 Missing and 5 partials ⚠️
cmd/util/cmd/run-script/cmd.go 0.00% 7 Missing ⚠️
access/handler.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6737   +/-   ##
=======================================
  Coverage   40.98%   40.99%           
=======================================
  Files        2103     2103           
  Lines      184900   184988   +88     
=======================================
+ Hits        75783    75832   +49     
- Misses     102750   102780   +30     
- Partials     6367     6376    +9     
Flag Coverage Δ
unittests 40.99% <32.50%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Guitarheroua Guitarheroua self-assigned this Nov 20, 2024
@Guitarheroua Guitarheroua marked this pull request as ready for review November 21, 2024 07:42
Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a few small comments, but otherwise looks good

cmd/util/cmd/run-script/cmd.go Outdated Show resolved Hide resolved
engine/access/rpc/backend/backend_stream_transactions.go Outdated Show resolved Hide resolved
engine/access/rpc/backend/backend_stream_transactions.go Outdated Show resolved Hide resolved
engine/access/rpc/backend/backend_stream_transactions.go Outdated Show resolved Hide resolved
Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a couple more comments, but otherwise looks good.

ctx context.Context,
tx *flow.TransactionBody,
requiredEventEncodingVersion entities.EventEncodingVersion,
) subscription.Subscription {
nextHeight, err := b.blockTracker.GetStartHeightFromBlockID(tx.ReferenceBlockID)
if err := b.sendTransaction(ctx, tx); err != nil {
b.log.Error().Err(err).Str("tx_id", tx.ID().String()).Msg("failed to send transaction")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid logging errors for api client issues since this can cause extremely noisy error level logging for larger operators.

Suggested change
b.log.Error().Err(err).Str("tx_id", tx.ID().String()).Msg("failed to send transaction")
b.log.Debug().Err(err).Str("tx_id", tx.ID().String()).Msg("failed to send transaction")

if err != nil {
return subscription.NewFailedSubscription(err, "could not get start height")
b.log.Error().Err(err).Msg("failed to retrieve latest block")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually throw an exception since the node must have the current sealed block in storage.
e.g.

irrecoverable.Throw(ctx, err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Access] Pending response from send and subscribe should return immediately
3 participants