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

修改Token/Ticket的同步机制以支持集群 #82

Merged
merged 1 commit into from
Nov 22, 2016

Conversation

ericlogic
Copy link

@ericlogic ericlogic commented Nov 21, 2016

目前对于AccessToken、JsapiTicket和CardApiTicket在更新时的同步都是通过synchronized关键词来实现的,这样在进行集群时会有问题。
这个补丁修改了这些接口的同步机制,使用锁进行同步,并由WxMpConfigStorage提供锁的具体实现。在默认的WxMpInMemoryConfigStorage中直接使用了ReentrantLock来提供单服务器中多线程的同步。
对于需要集群的场景,可以通过缓存中间件来实现WxMpConfigStorage和Lock。以Redis为例,开发者只需提供Redis版的WxMpConfigStorage和Redis版本的锁实现即可。

企业号也存在类似的问题,因为暂时没有涉及企业号的开发,因此没有对企业号做相应的修改和测试。

@binarywang binarywang merged commit 6278161 into Wechat-Group:develop Nov 22, 2016
@binarywang
Copy link
Member

@iwareserictsai 感谢提供代码,不过在进行单元测试出现问题,我已经修复了单元测试代码

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

Successfully merging this pull request may close these issues.

None yet

2 participants