Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement a subscriptions sync algorithm between auth-server and subhub? #1148
While working through #719, it occurred to me that we could implement a small "sync" algorithm to help make subscriptions consistent between FxA, subhub, and Stripe:
I imagine this wouldn't run very frequently per user, but it would be interesting to work out where it would be useful to do so. For example, on a visit to the payment pages with a fresh access token might be a good point to run it - that might help resolve any inconsistencies just before a user tries to manage subscription.
This would be in addition to #713 as a kind of belt-and-suspenders way to maintain consistency
I think this makes sense to do on-demand during login and/or visiting the Account Management page. This provides another way to ensure any event handling mismatches repair themselves quickly.
We should also ensure that any means we have that a user can trigger to force sync should be known by Support so that any issues a user may experience with inconsistent subscription status propagation can be easily resolved for the few users that may be affected.
Haven't looked at this issue in awhile, but the thing I've been thinking lately: We probably want to drop the subscriptions table in FxA auth-server altogether.
All the relevant information for subscriptions is in the subhub customer record. So, auth-server should just cache this resource to save traffic against subhub & stripe, then use that data to calculate subscription capabilities. That way, there's no granular sync per se, just cache revalidation