Skip to content

Commit b41891e

Browse files
committed
fix: 改为hotValue取值
1 parent 6e31797 commit b41891e

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "midway-apollo",
3-
"version": "1.0.14",
3+
"version": "1.0.16",
44
"description": "",
55
"main": "dist/index.js",
66
"typings": "index.d.ts",

src/configuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ApolloConfiguration {
2727
this.decoratorService.registerPropertyHandler(
2828
APOLLO,
2929
(propertyName, meta) => {
30-
return this.apolloService.getValue(meta.key);
30+
return this.apolloService.hotValue(meta.key).value;
3131
}
3232
);
3333
}

src/manager.ts

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class ApolloServiceFactory extends ServiceFactory<CtripApolloClient> {
3636
return client;
3737
} catch (error) {
3838
this.logger.error('[midway:apollo] client error: %s', error);
39+
return;
3940
}
4041
}
4142

test/index.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ describe('/test/index.test.ts', () => {
1717
.getApplicationContext()
1818
.getAsync(ApolloService);
1919

20-
expect(apolloService.getValue('mysql.port:3306')).toBe('3306');
21-
expect(apolloService.getValue('mysql.host:127.0.0.1')).toBe('127.0.0.1');
20+
expect(apolloService.hotValue('mysql.port:3306').value).toBe('3306');
21+
expect(apolloService.hotValue('mysql.host:127.0.0.1').value).toBe(
22+
'127.0.0.1'
23+
);
2224
});
2325
});

0 commit comments

Comments
 (0)