-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Net6+ 调整IList<IConfigurationSource>的顺序之后Apollo的热更新不工作了. #203
Comments
试了下,先调用builder.Sources.clear(),然后按照自己想要的顺序添加source,就不会丢掉changeLinstener。在builder.Sources.clear()之前,可以先把builder.Sources的所有Sources按照类型存在不同的List临时变量里,后面再用。 我这样写可以:
|
@zhaobotao 是的, 保存之前的sources, 在根据自己的规则调整add顺序, builder.Sources.Clear()的时候也是会dispose所有的provider的, 您上面的代码没问题是因为apollo的source没有在此之前加入. 所以这个issue是建议要不要考虑把ConfigurationProvider和IConfigurationSource 的实现从ApolloConfigurationProvider独立开来.
|
ConfigurationSources 的Insert,Remove,Clear 都会调用ReloadSources(). 然后_providerManager.ReplaceProviders(list);, 然后在ReplaceProviders里面就吧之前的全部dispose.
|
这里的情况也差不多 @zhaobotao apollo.net/src/Apollo.Configuration/ApolloConfigurationExtensions.cs Lines 60 to 61 in 8b85720
|
Closed by #236 |
Net6+ 通过WebApplicationBuilder配置application, configuration系统换成了ConfigurationManager的实现.
通过ConfigurationManager.Sources.[Insert,Remove,Add] 调整source的顺序的时候, 会导致 dispose ApolloConfigurationProvider对象, 进而导致丢掉对changeLinstener的调用.
是不是考虑吧ConfigurationProvider和IConfigurationSource 的实现从ApolloConfigurationProvider独立开来.
The text was updated successfully, but these errors were encountered: