-
Notifications
You must be signed in to change notification settings - Fork 39
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
Rework cache #2224
Rework cache #2224
Conversation
@@ -114,6 +114,12 @@ func fetchFromCache(ctx context.Context, storage storage.Storage, cacheService * | |||
} | |||
} | |||
r := marshalReceipt(rec.Receipt, logs, rec.From, rec.To) | |||
|
|||
// after the receipt was requested by a user remove it from the cache | |||
err := cacheService.DelReceipt(ctx, txHash) |
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.
why?
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.
because it means that the user doesn't need it any more. Basically, polling will stop when a receipt is returned
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.
LGTM, tho i don't understand where the issue with the perf is
During the perf test, some receipts are not fetched from the cache, even though everything should be cached. |
go/enclave/rpc/GetTransaction.go
Outdated
if rec != nil { | ||
rpc.logger.Debug("Cache hit for tx", log.TxKey, txHash) | ||
// authorise - only the signer can request the transaction | ||
if rec.From.Hex() != requester.Hex() { |
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 hex comparison feels a bit weird
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.
LGTM
Why this change is needed
Under normal operation, this change should avoid most DB access when users poll for transactions they submitted recently
What changes were made as part of this PR
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks