diff --git a/api/routes/loadout-share.ts b/api/routes/loadout-share.ts index ea8b5c6..2fdfd91 100644 --- a/api/routes/loadout-share.ts +++ b/api/routes/loadout-share.ts @@ -13,10 +13,6 @@ import { } from '../shapes/loadout-share.js'; import { Loadout } from '../shapes/loadouts.js'; import { UserInfo } from '../shapes/user.js'; -import { - deleteLoadoutShare, - getLoadoutShare as getLoadoutShareStately, -} from '../stately/loadout-share-queries.js'; import slugify from './slugify.js'; import { validateLoadout } from './update.js'; @@ -129,43 +125,5 @@ export async function loadLoadoutShare(shareId: string) { recordAccess(client, shareId), ); - if (loadout) { - return loadout; - } - - // Fall back to Stately, and backfill into Postgres if found - const result = await getLoadoutShareStately(shareId); - if (!result) { - return undefined; - } - - // Backfill in Postgres - const backfilled = await transaction(async (client) => { - try { - await addLoadoutShare( - client, - undefined, - result.platformMembershipId, - shareId, - result.loadout, - result.viewCount, - ); - return true; - } catch (e) { - // This is a unique constraint violation, give up - if (e instanceof DatabaseError && e.code === '23505') { - await client.query('ROLLBACK'); - return false; - } else { - throw e; - } - } - }); - - if (backfilled) { - // Remove from Stately only if we successfully backfilled - await deleteLoadoutShare(shareId); - } - - return result.loadout; + return loadout; } diff --git a/kubernetes/dim-api-stately-backfill-job.yaml b/kubernetes/dim-api-stately-backfill-job.yaml index 836d42c..89b6ce9 100644 --- a/kubernetes/dim-api-stately-backfill-job.yaml +++ b/kubernetes/dim-api-stately-backfill-job.yaml @@ -48,7 +48,7 @@ spec: - name: BACKFILL_PARALLEL_SEGMENTS value: '4' - name: BACKFILL_TOKEN_PATH - value: /var/lib/dim-api-backfill/backfill-token.bin + value: /var/lib/dim-api-backfill/backfill-token2.bin - name: BACKFILL_RETRY_MAX_ATTEMPTS value: '12' - name: BACKFILL_RETRY_BASE_DELAY_MS