Skip to content

Commit

Permalink
fix:re enable v2 test on 20% of the updates
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Nov 1, 2024
1 parent 93f4729 commit 432bf84
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions supabase/functions/_backend/utils/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
parse,
tryParse,
} from '@std/semver'
import { getRuntimeKey } from 'hono/adapter'
import { saveStoreInfoCF } from './cloudflare.ts'
import { appIdToUrl } from './conversion.ts'
import { getBundleUrl, getManifestUrl } from './downloadUrl.ts'
Expand Down Expand Up @@ -415,12 +416,14 @@ export async function updateWithPG(c: Context, body: AppInfos, drizzleCient: Ret

export async function update(c: Context, body: AppInfos) {
let pgClient
const isV2 = c.req.url.endsWith('/updates_v2')
// re enable when understand why the endpoint do not respond properly
// if (!isV2) {
// // make 20% chance to be v2
// isV2 = Math.random() < 0.2
// }
let isV2 = false
if (c.req.url.endsWith('/updates_v2') && getRuntimeKey() === 'workerd') {
isV2 = true
}
if (!isV2 && getRuntimeKey() === 'workerd') {
// make 20% chance to be v2
isV2 = Math.random() < 0.2
}
// check if URL ends with update_v2 if yes do not init PG
if (isV2) {
console.log({ requestId: c.get('requestId'), context: 'update2', isV2 })
Expand Down

0 comments on commit 432bf84

Please sign in to comment.