evict packages from cache on SaveBackend
This commit is contained in:
parent
f3a9d138d7
commit
5af53922ed
|
@ -183,7 +183,7 @@ export const saveCurrentNode = store => () => {
|
||||||
const defaultIndex = templateApi(state.hierarchy).getNewIndexTemplate(
|
const defaultIndex = templateApi(state.hierarchy).getNewIndexTemplate(
|
||||||
cloned.parent()
|
cloned.parent()
|
||||||
)
|
)
|
||||||
defaultIndex.name = `all_${cloned.name}`
|
defaultIndex.name = `all_${cloned.name}s`
|
||||||
defaultIndex.allowedRecordNodeIds = [cloned.nodeId]
|
defaultIndex.allowedRecordNodeIds = [cloned.nodeId]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,7 @@ module.exports = (config, app) => {
|
||||||
ctx.request.body.appDefinition,
|
ctx.request.body.appDefinition,
|
||||||
ctx.request.body.accessLevels
|
ctx.request.body.accessLevels
|
||||||
)
|
)
|
||||||
|
ctx.master.deleteLatestPackageFromCache(ctx.params.appname)
|
||||||
ctx.response.status = StatusCodes.OK
|
ctx.response.status = StatusCodes.OK
|
||||||
})
|
})
|
||||||
.post("/_builder/api/:appname/pages/:pageName", async ctx => {
|
.post("/_builder/api/:appname/pages/:pageName", async ctx => {
|
||||||
|
|
|
@ -5,12 +5,16 @@ const { getRuntimePackageDirectory } = require("../utilities/runtimePackages")
|
||||||
const injectPlugins = require("./injectedPlugins")
|
const injectPlugins = require("./injectedPlugins")
|
||||||
const { cwd } = require("process")
|
const { cwd } = require("process")
|
||||||
|
|
||||||
|
const appDefinitionPath = appPath => join(appPath, "appDefinition.json")
|
||||||
|
const pluginsPath = appPath => join(appPath, "plugins.js")
|
||||||
|
const accessLevelsPath = appPath => join(appPath, "access_levels.json")
|
||||||
|
|
||||||
const createAppPackage = (context, appPath) => {
|
const createAppPackage = (context, appPath) => {
|
||||||
const appDefModule = require(join(appPath, "appDefinition.json"))
|
const appDefModule = require(appDefinitionPath(appPath))
|
||||||
|
|
||||||
const pluginsModule = require(join(appPath, "plugins.js"))
|
const pluginsModule = require(pluginsPath(appPath))
|
||||||
|
|
||||||
const accessLevels = require(join(appPath, "access_levels.json"))
|
const accessLevels = require(accessLevelsPath(appPath))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
appDefinition: appDefModule,
|
appDefinition: appDefModule,
|
||||||
|
@ -87,3 +91,11 @@ module.exports.applictionVersionPackage = async (
|
||||||
await injectPlugins(pkg, context.master, appname, instanceKey)
|
await injectPlugins(pkg, context.master, appname, instanceKey)
|
||||||
return pkg
|
return pkg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.deleteCachedPackage = (context, appname, versionId) => {
|
||||||
|
const appPath = applictionVersionPath(context, appname, versionId)
|
||||||
|
|
||||||
|
delete require.cache[resolve(appDefinitionPath(appPath))]
|
||||||
|
delete require.cache[resolve(pluginsPath(appPath))]
|
||||||
|
delete require.cache[resolve(accessLevelsPath(appPath))]
|
||||||
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ const {
|
||||||
masterAppPackage,
|
masterAppPackage,
|
||||||
applictionVersionPackage,
|
applictionVersionPackage,
|
||||||
applictionVersionPublicPaths,
|
applictionVersionPublicPaths,
|
||||||
|
deleteCachedPackage,
|
||||||
} = require("../utilities/createAppPackage")
|
} = require("../utilities/createAppPackage")
|
||||||
const { determineVersionId } = require("./runtimePackages")
|
const { determineVersionId, LATEST_VERSIONID } = require("./runtimePackages")
|
||||||
|
|
||||||
const isMaster = appname => appname === "_master"
|
const isMaster = appname => appname === "_master"
|
||||||
|
|
||||||
|
@ -345,6 +346,10 @@ module.exports = async context => {
|
||||||
await bb.recordApi.save(userInMaster)
|
await bb.recordApi.save(userInMaster)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deleteLatestPackageFromCache = (appname) => {
|
||||||
|
deleteCachedPackage(context, appname, LATEST_VERSIONID)
|
||||||
|
}
|
||||||
|
|
||||||
const listApplications = () => values(applications)
|
const listApplications = () => values(applications)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -364,5 +369,6 @@ module.exports = async context => {
|
||||||
getFullAccessApiForInstanceId,
|
getFullAccessApiForInstanceId,
|
||||||
getFullAccessApiForMaster,
|
getFullAccessApiForMaster,
|
||||||
getApplicationWithInstances,
|
getApplicationWithInstances,
|
||||||
|
deleteLatestPackageFromCache,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue