Repository navigation
Keep a parked Twitch reconcile through a stale revocation, and share the subscriptions HTTP client - #1699
Merged
Conversation
…dcaster re-authorized, and share the subscriptions HTTP client
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from the #1694 review.
Lost reconcile:
subscribeTwitchenqueues a reconcile while it still holds thetwitch:<id>lease, so the worker parks the reconcile as busy for 5s. If a lateauthorization_revokedrevocation from an earlier deauthorization lands in that window,EnqueueRemoveoverwritesitem.job. The removal then sees the broadcaster re-authorized, skips, and deletes the item, so the reconcile is gone and no subscriptions get created until the next subscribe. Items now carry areconcileflag that is set whenever a reconcile is requested. A removal that ends with outcomereauthorizedswitches the item back to the reconcile with fresh retry state instead of dropping it. A removal that actually deletes still drops the item, so a real deauthorization after a subscribe still wins.Tests in
TestTwitchQueueLatestIntentWins:stale revocation while reconcile is parkedfails on main.re-authorized without a reconcilechecks that a plain skipped removal does nothing.HTTP client:
cmd/main.goleftsubscriptions.API.Clientnil, so every Helix request (now including the/usersre-authorization check) built a newhttp.Client. One client is now shared betweenprovider.NewServiceandAPI.Client, the same wayjobs.godoes it.