fix(statics): scope FindBucket to the app's org#4826
Closed
Conversation
FindBucket was calling the top-level addOns(type: tigris) query, which returns every tigris add-on the caller can see across every org and then filters client-side by org + metadata. For accounts with a lot of tigris add-ons this stalls `fly apps destroy` (and `fly apps move`). Use Organization.addOns(type:) via a new ListOrganizationAddOns query so we only transfer the relevant org's add-ons. Metadata-based app matching stays the same, since existing statics buckets are not linked by app_id.
7 tasks
Member
Author
|
Wound up solving this better with #4827 which defaults new statics to link directly to an app then falls back to what this was doing anyways. |
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.
Summary
statics.FindBucketwas calling the top-leveladdOns(type: tigris)GraphQL query, which returns every tigris add-on the caller can see across every org and then filters client-side by org slug + metadata pointer. For accounts with a lot of tigris add-ons this stallsfly apps destroy(andfly apps move), since both runFindBucketbefore doing anything useful.ListOrganizationAddOns($orgSlug, $addOnType)query (web'sOrganization.addOns(type:)already supports this) and switchesFindBucketover. We still match the specific bucket by theapp_idmetadata pointer — existing statics buckets aren't linked viaadd_ons.app_id, so org-scope is the tightest we can get without a backfill.statics.Buckettype alias so callers don't have to name the generated type directly.Follow-ups (separate PRs)
params.AppNameinensureBucketCreatedso new statics buckets are linked to their app viaadd_ons.app_id.FindBucketto queryApp.addOns(type: tigris)(via the existingGetAppWithAddons) and keep the org-scoped query as a legacy fallback.Test plan
go build ./...(passes locally)go vet ./internal/command/deploy/statics/... ./internal/command/apps/... ./gql/...(passes locally)fly apps destroyon an app that does have a statics bucket — confirm the bucket is still cleaned up.fly apps destroyon an app without a statics bucket in an org with many tigris add-ons — confirm it returns quickly instead of timing out.fly apps moveon an app with a statics bucket — confirm the bucket still gets migrated to the new org.