1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00
This commit is contained in:
mike12345567 2024-06-13 17:50:07 +01:00
parent 8970705b39
commit 3dcce65c9c

View file

@ -23,15 +23,16 @@ const getCacheKey = (appId: string) => `appmigrations_${env.VERSION}_${appId}`
export async function getAppMigrationVersion(appId: string): Promise<string> { export async function getAppMigrationVersion(appId: string): Promise<string> {
const cacheKey = getCacheKey(appId) const cacheKey = getCacheKey(appId)
let version: string | undefined = await cache.get(cacheKey) let metadata: AppMigrationDoc | undefined = await cache.get(cacheKey)
// returned cached version if we found one // returned cached version if we found one
if (version) { if (metadata?.version) {
return version return metadata.version
} }
let version
try { try {
const metadata = await getFromDB(appId) metadata = await getFromDB(appId)
version = metadata.version || "" version = metadata.version || ""
} catch (err: any) { } catch (err: any) {
if (err.status !== 404) { if (err.status !== 404) {