Skip to content

Commit

Permalink
fix: Stop storing messenger manually in CronjobController
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Jan 10, 2025
1 parent 71ab7c3 commit 71fb62a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/snaps-controllers/src/cronjob/CronjobController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ export class CronjobController extends BaseController<
CronjobControllerState,
CronjobControllerMessenger
> {
#messenger: CronjobControllerMessenger;

#dailyTimer!: Timer;

#timers: Map<string, Timer>;
Expand All @@ -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 =
Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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: '',
Expand Down

0 comments on commit 71fb62a

Please sign in to comment.