Merge pull request #1099 from balena-io/db-target-state-cache

Add a cache around the database application target state
This commit is contained in:
CameronDiver 2019-10-07 16:19:03 +01:00 committed by GitHub
commit 12f68634d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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' { ContractViolationError, ContractValidationError, NotFoundError } = require './lib/errors'
{ pathExistsOnHost } = require './lib/fs-utils' { pathExistsOnHost } = require './lib/fs-utils'
{ ApplicationTargetStateWrapper } = require './target-state' { TargetStateAccessor } = require './target-state'
{ ServiceManager } = require './compose/service-manager' { ServiceManager } = require './compose/service-manager'
{ Service } = require './compose/service' { Service } = require './compose/service'
@ -82,7 +82,7 @@ module.exports = class ApplicationManager extends EventEmitter
@_targetVolatilePerImageId = {} @_targetVolatilePerImageId = {}
@_containerStarted = {} @_containerStarted = {}
@targetStateWrapper = new ApplicationTargetStateWrapper(this, @config, @db) @targetStateWrapper = new TargetStateAccessor(this, @config, @db)
@config.on 'change', (changedConfig) => @config.on 'change', (changedConfig) =>
if changedConfig.appUpdatePollInterval if changedConfig.appUpdatePollInterval

View File

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