Skip to content

Commit

Permalink
fix: health check missing this resolver (#3700)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed May 6, 2024
1 parent 1bb51da commit eedd961
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/service/healthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export class MidwayHealthService {
lifecycleInstance.instance['onHealthCheck']
) {
this.healthCheckMethods.push({
item: lifecycleInstance.instance['onHealthCheck'],
item: lifecycleInstance.instance['onHealthCheck'].bind(
lifecycleInstance.instance
),
meta: {
namespace: lifecycleInstance.namespace,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { Configuration, ILifeCycle, sleep } from '../../../../src';
import { ApplicationContext, Configuration, ILifeCycle, IMidwayContainer, sleep } from '../../../../src';
import { ok } from 'assert';

@Configuration({
})
export class AutoConfiguration implements ILifeCycle {
@ApplicationContext()
applicationContext: IMidwayContainer;
async onReady(){}

async onHealthCheck() {
ok(this.applicationContext);
await sleep(100);
return {
status: true,
Expand Down

0 comments on commit eedd961

Please sign in to comment.