1
0
Fork 0
mirror of synced 2024-10-04 03:54:37 +13:00

Making sure we return the correct thing when passing back the cached migration version.

This commit is contained in:
mike12345567 2024-06-13 17:50:35 +01:00
parent 3dcce65c9c
commit 82af6deab3

View file

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