Add a cache around the database application target state

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-09-26 15:03:36 +01:00
parent 47d39b70d8
commit 7b8e7ea8ca
No known key found for this signature in database
GPG Key ID: 49690ED87032539F
2 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ updateLock = require './lib/update-lock'
{ ContractViolationError, ContractValidationError, NotFoundError } = require './lib/errors'
{ pathExistsOnHost } = require './lib/fs-utils'
{ ApplicationTargetStateWrapper } = require './target-state'
{ TargetStateAccessor } = require './target-state'
{ ServiceManager } = require './compose/service-manager'
{ Service } = require './compose/service'
@ -82,7 +82,7 @@ module.exports = class ApplicationManager extends EventEmitter
@_targetVolatilePerImageId = {}
@_containerStarted = {}
@targetStateWrapper = new ApplicationTargetStateWrapper(this, @config, @db)
@targetStateWrapper = new TargetStateAccessor(this, @config, @db)
@config.on 'change', (changedConfig) =>
if changedConfig.appUpdatePollInterval

View File

@ -20,7 +20,7 @@ export type DatabaseApps = DatabaseApp[];
* line. This can very quickly cause serious memory problems
* and database connection timeouts.
*/
export class ApplicationTargetStateWrapper {
export class TargetStateAccessor {
private targetState?: DatabaseApps;
public constructor(
@ -77,4 +77,4 @@ export class ApplicationTargetStateWrapper {
}
}
export default ApplicationTargetStateWrapper;
export default TargetStateAccessor;