Clearing upp app cache a bit more safely.
This commit is contained in:
parent
fe44c467fd
commit
762d28f305
|
@ -635,6 +635,11 @@ async function unpublishApp(ctx: UserCtx) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function invalidateAppCache(appId: string) {
|
||||||
|
await cache.app.invalidateAppMetadata(dbCore.getDevAppID(appId))
|
||||||
|
await cache.app.invalidateAppMetadata(dbCore.getProdAppID(appId))
|
||||||
|
}
|
||||||
|
|
||||||
async function destroyApp(ctx: UserCtx) {
|
async function destroyApp(ctx: UserCtx) {
|
||||||
let appId = ctx.params.appId
|
let appId = ctx.params.appId
|
||||||
appId = dbCore.getProdAppID(appId)
|
appId = dbCore.getProdAppID(appId)
|
||||||
|
@ -659,12 +664,16 @@ async function destroyApp(ctx: UserCtx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
await removeAppFromUserRoles(ctx, appId)
|
await removeAppFromUserRoles(ctx, appId)
|
||||||
await cache.app.invalidateAppMetadata(devAppId)
|
await invalidateAppCache(appId)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
async function preDestroyApp(ctx: UserCtx) {
|
async function preDestroyApp(ctx: UserCtx) {
|
||||||
const { rows } = await getUniqueRows([ctx.params.appId])
|
// invalidate the cache immediately in-case they are leading to
|
||||||
|
// zombie appearing apps
|
||||||
|
const appId = ctx.params.appId
|
||||||
|
await invalidateAppCache(appId)
|
||||||
|
const { rows } = await getUniqueRows([appId])
|
||||||
ctx.rowCount = rows.length
|
ctx.rowCount = rows.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue