-
Notifications
You must be signed in to change notification settings - Fork 307
fix(pulse): reset priceLastUpdatedAt when price IDs are added in updateSubscription #2674
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
fix(pulse): reset priceLastUpdatedAt when price IDs are added in updateSubscription #2674
Conversation
…ubscription Co-Authored-By: Tejas Badadare <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Closing due to inactivity for more than 7 days. |
| bool priceIdsChanged = _clearRemovedPriceUpdates( | ||
| subscriptionId, | ||
| currentParams.priceIds, | ||
| newParams.priceIds | ||
| ); | ||
|
|
||
| // Reset priceLastUpdatedAt to 0 if price IDs have changed | ||
| if (priceIdsChanged) { | ||
| _state.subscriptionStatuses[subscriptionId].priceLastUpdatedAt = 0; | ||
| } | ||
|
|
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.
It would be more accurate to reset priceLastUpdatedAt only when new prices are added (not just on any change to price ids.)
Co-Authored-By: Tejas Badadare <[email protected]>
…evin/1747071611-reset-pricelastupdatedat-on-subscription-update
Reset priceLastUpdatedAt when price IDs are added in updateSubscription
Description
This PR fixes an issue in the
Scheduler.solcontract wherepriceLastUpdatedAtwas not being reset when thepriceIdslist was added to in theupdateSubscriptionfunction. This could prevent immediate calls toupdatePriceFeedsafter a subscription update because:heartbeatSecondsenforces a minimum time sincepriceLastUpdatedAtpublishTimegreater thanpriceLastUpdatedAtThe fix modifies the
_clearRemovedPriceUpdatesfunction to return a boolean indicating whether price IDs have been added, and then resetspriceLastUpdatedAtto 0 inupdateSubscriptionwhen this occurs.Changes
_clearRemovedPriceUpdatesto return a boolean indicating if price IDs were addedupdateSubscriptionto resetpriceLastUpdatedAtto 0 when price IDs are addedPulseScheduler.t.solto verify the fix works as expectedTesting
testUpdateSubscriptionResetsPriceLastUpdatedAtthat verifies:priceLastUpdatedAtis reset to 0 when price IDs are addedRequested by
Tejas Badadare ([email protected])
Link to Devin run
https://app.devin.ai/sessions/143f676aadca48d8a5e491864dff0917