Skip to content
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

getservice 获取服务的建议 #843

Open
secondtonone1 opened this issue Jun 10, 2020 · 2 comments
Open

getservice 获取服务的建议 #843

secondtonone1 opened this issue Jun 10, 2020 · 2 comments

Comments

@secondtonone1
Copy link

最近使用了event通信,simple_event包中有两个服务,serviceA用来广播,serviceB用来注册消息等待出发回调函数。serviceA和serviceB写在不同的文件中,这两个文件的init函数里会调用node.Setup这两个服务,但是如果serviceB先注册,serviceA后注册就会出现这样的问题,serviceB想在OnInit函数中获取serviceA,这个时候是获取不到的。如果能保证serviceA注册顺序优先于serviceB就没有问题。具体底层源码我还没看,最近使用出现了这个问题。
为了解决这个问题,我在simple_event这个包的init函数中保证广播的服务先注册就没问题了。

@duanhf2012
Copy link
Owner

这个问题我适时优化一下,确实存在先后顺序问题。

@secondtonone1
Copy link
Author

嗯,您的代码质量很高,向您不断地学习

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants