Skip to content

Commit

Permalink
fix: app subprocess restart not running onEnable lifecycle (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert authored Dec 13, 2024
1 parent f0963e2 commit c037493
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/server/AppManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,10 @@ export class AppManager {
result = false;

await app.setStatus(status, silenceStatus);

// If some error has happened in initialization, like license or installations invalidation
// we need to store this on the DB regardless of what the parameter requests
saveToDb = true;
}

if (saveToDb) {
Expand Down Expand Up @@ -1038,6 +1042,10 @@ export class AppManager {
}

console.error(e);

// If some error has happened during enabling, like license or installations invalidation
// we need to store this on the DB regardless of what the parameter requests
saveToDb = true;
}

if (enable) {
Expand Down
6 changes: 5 additions & 1 deletion src/server/runtime/deno/AppsEngineDenoRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { AppBridges } from '../../bridges';
import type { IParseAppPackageResult } from '../../compiler';
import { AppConsole, type ILoggerStorageEntry } from '../../logging';
import type { AppAccessorManager, AppApiManager } from '../../managers';
import { AppStatus } from '../../../definition/AppStatus';
import { AppStatus, AppStatusUtils } from '../../../definition/AppStatus';
import type { AppMethod } from '../../../definition/metadata';
import { bundleLegacyApp } from './bundler';
import { ProcessMessenger } from './ProcessMessenger';
Expand Down Expand Up @@ -294,6 +294,10 @@ export class DenoRuntimeSubprocessController extends EventEmitter {
await this.sendRequest({ method: 'app:initialize' });
await this.sendRequest({ method: 'app:setStatus', params: [status] });

if (AppStatusUtils.isEnabled(this.storageItem.status)) {
await this.sendRequest({ method: 'app:onEnable' });
}

this.state = 'ready';

logger.info('Successfully restarted app subprocess');
Expand Down

0 comments on commit c037493

Please sign in to comment.