Skip to content

Commit

Permalink
fix: decorator manager singleton (#1211)
Browse files Browse the repository at this point in the history
* fix: decorator manager singleton

* fix: ws typings
  • Loading branch information
czy88840616 authored Aug 7, 2021
1 parent 7d978a2 commit 7e9150e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/decorator/src/common/decoratorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,12 @@ export class DecoratorManager extends Map {
}
}

const manager = new DecoratorManager();
let manager = new DecoratorManager();
if (global['MIDWAY_GLOBAL_DECORATOR_MANAGER']) {
console.warn(
'DecoratorManager not singleton and please check @midwayjs/decorator version by "npm ls @midwayjs/decorator"'
);
manager = global['MIDWAY_GLOBAL_DECORATOR_MANAGER'];
} else {
global['MIDWAY_GLOBAL_DECORATOR_MANAGER'] = manager;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ws/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MidwayWSFramework extends BaseFramework<
}

server.on('upgrade', (request, socket, head) => {
this.app.handleUpgrade(request, socket, head, ws => {
this.app.handleUpgrade(request, socket as any, head, ws => {
this.app.emit('connection', ws, request);
});
});
Expand Down

0 comments on commit 7e9150e

Please sign in to comment.