-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[FUN-877] Persist subscriptions fetched from contracts #11573
[FUN-877] Persist subscriptions fetched from contracts #11573
Conversation
I see that you haven't updated any README files. Would it make sense to do so? |
a8d4add
to
8718c46
Compare
8613b6b
to
2b4c9fb
Compare
2ab33de
to
d26839a
Compare
4380e1b
to
05a16d1
Compare
err = s.orm.UpsertSubscription(CachedSubscription{ | ||
SubscriptionID: subscriptionId, | ||
RouterContractAddress: s.router.Address(), | ||
IFunctionsSubscriptionsSubscription: subscription, | ||
}) | ||
if err != nil { | ||
s.lggr.Errorf("unexpected error updating subscription in the cache: %w", err) | ||
} |
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.
💭 We can persist this async if we think this might become a bottleneck
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.
Can we call Upsert only when the value changed? That would save us a lot of unnecessary DB calls.
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.
changed the subscription implementation to return a true
when an actual update was performed, now it should only update the db when a value changes.
err = s.orm.UpsertSubscription(CachedSubscription{ | ||
SubscriptionID: subscriptionId, | ||
RouterContractAddress: s.router.Address(), | ||
IFunctionsSubscriptionsSubscription: subscription, | ||
}) | ||
if err != nil { | ||
s.lggr.Errorf("unexpected error updating subscription in the cache: %w", err) | ||
} |
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.
Can we call Upsert only when the value changed? That would save us a lot of unnecessary DB calls.
1825524
to
b0d79cd
Compare
b0d79cd
to
3f45ccb
Compare
55ed335
to
c52163d
Compare
SonarQube Quality Gate |
Description
This PR introduces a cache layer that will persist the subscriptions fetched from contracts.