From 400e34699f25eb05887c0d10b13429a0fc1f0621 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Fri, 10 Jan 2025 14:27:19 +0100 Subject: [PATCH] fix: Stop storing messenger manually in CronjobController --- .../snaps-controllers/src/cronjob/CronjobController.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/snaps-controllers/src/cronjob/CronjobController.ts b/packages/snaps-controllers/src/cronjob/CronjobController.ts index f93995c9c2..403b3c6e19 100644 --- a/packages/snaps-controllers/src/cronjob/CronjobController.ts +++ b/packages/snaps-controllers/src/cronjob/CronjobController.ts @@ -122,8 +122,6 @@ export class CronjobController extends BaseController< CronjobControllerState, CronjobControllerMessenger > { - #messenger: CronjobControllerMessenger; - #dailyTimer!: Timer; #timers: Map; @@ -147,7 +145,6 @@ export class CronjobController extends BaseController< }); this.#timers = new Map(); this.#snapIds = new Map(); - this.#messenger = messenger; this._handleSnapRegisterEvent = this._handleSnapRegisterEvent.bind(this); this._handleSnapUnregisterEvent = @@ -227,7 +224,7 @@ export class CronjobController extends BaseController< * @returns Array of Cronjob specifications. */ #getSnapJobs(snapId: SnapId): Cronjob[] | undefined { - const permissions = this.#messenger.call( + const permissions = this.messagingSystem.call( 'PermissionController:getPermissions', snapId, ); @@ -303,7 +300,7 @@ export class CronjobController extends BaseController< */ async #executeCronjob(job: Cronjob) { this.#updateJobLastRunState(job.id, Date.now()); - await this.#messenger.call('SnapController:handleRequest', { + await this.messagingSystem.call('SnapController:handleRequest', { snapId: job.snapId, origin: '', handler: HandlerType.OnCronjob, @@ -387,7 +384,7 @@ export class CronjobController extends BaseController< const timer = new Timer(ms); timer.start(() => { - this.#messenger + this.messagingSystem .call('SnapController:handleRequest', { snapId: event.snapId, origin: '',