mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-05-08 03:48:14 +00:00
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:
commit
12f68634d8
@ -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
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user