Skip to content

Commit

Permalink
fix(framework): don't enable profiler per default
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Nov 9, 2023
1 parent 3b165d6 commit 52a7e52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/framework/src/debug/stopwatch/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,4 @@ export class FileStopwatchStore extends StopwatchStore {
this.syncMutex.unlock();
}
}

}
6 changes: 5 additions & 1 deletion packages/framework/src/module.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ export class FrameworkConfig {

debugUrl: string = '_debug';

debugProfiler: boolean = true;
/**
* Whether profiling is enabled. This is automatically enabled when debug is enabled,
* but can be enabled separately.
*/
profile: boolean = false;

/**
* @description IP:Port or unix socket name or named pipes.
Expand Down
6 changes: 3 additions & 3 deletions packages/framework/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ export class FrameworkModule extends createModule({
this.addProvider({ provide: StopwatchStore, useExisting: FileStopwatchStore });
this.addProvider({
provide: Stopwatch,
useFactory(store: StopwatchStore, profile: FrameworkConfig['debugProfiler']) {
useFactory(store: StopwatchStore, config: FrameworkConfig) {
const stopwatch = new Stopwatch(store);
if (profile) {
if (config.profile || config.debug) {
stopwatch.enable();
} else {
stopwatch.disable();
Expand All @@ -243,7 +243,7 @@ export class FrameworkModule extends createModule({
db.module.setupProvider(0, db.classType).eventDispatcher = injectorReference(EventDispatcher);
}

if (this.config.debug && this.config.debugProfiler) {
if (this.config.debug && this.config.profile) {
for (const db of this.dbs) {
db.module.setupProvider(0, db.classType).stopwatch = injectorReference(Stopwatch);
}
Expand Down

0 comments on commit 52a7e52

Please sign in to comment.