collab: Keep track of last seen Stripe event for each record (#15480)
This PR improves our Stripe event handling by keeping track of the last event we've seen for each record. The `billing_customers` and `billing_subscriptions` tables both have a new `last_stripe_event_id` column. When we apply an event to one of these records, we store the event ID that was applied. Then, when we are going through events we can ignore any event that has an ID that came before the `last_stripe_event_id` (based on the lexicographical ordering of the IDs). Release Notes: - N/A
This commit is contained in:
parent
2ada2964c5
commit
b160e13f20
9 changed files with 253 additions and 34 deletions
|
@ -9,6 +9,7 @@ pub struct Model {
|
|||
pub id: BillingCustomerId,
|
||||
pub user_id: UserId,
|
||||
pub stripe_customer_id: String,
|
||||
pub last_stripe_event_id: Option<String>,
|
||||
pub created_at: DateTime,
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ pub struct Model {
|
|||
pub billing_customer_id: BillingCustomerId,
|
||||
pub stripe_subscription_id: String,
|
||||
pub stripe_subscription_status: StripeSubscriptionStatus,
|
||||
pub last_stripe_event_id: Option<String>,
|
||||
pub created_at: DateTime,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue