Open
Conversation
上一版本的代码不支持同时连接多个ssdb,原因是因为net连接的部分作为一个module的普通方法,被进程中的其他js共用了,因此申明多个连接时前面的net连接会被后面的覆盖。 解决: 参照redis nodejs client,将net连接及监听的代码独立出来,每次connect的时候new 一个实例,同时支持多个连接,直接在SSDB.js上修改,调用方式不变。
Contributor
|
为什么整个文件都被改动了, 相当于完全重写? 真是这样吗? 如果是这样, 你可以创建一个新的 client. |
|
可能是windows ,unix 换行符得问题吧。 |
Contributor
|
换一个文本编辑器, 重新修改一下吧. 这样的改动无法被合并. |
|
按照他得修改,我来提交一份看看。 |
Contributor
|
Hi, 请问这个多连接问题是什么问题? 如何重现? |
Author
|
连接几个ssdb,不关闭的情况下,操作,影响的是最后连接上的那个。其实代码里就比较明显,socket连接是模块级的变量,整个vm共用的,所以每次连接new一个socket。可能,需要同时连接多个ssdb的应用场景不会很多吧,我是一个爬虫的项目:
|
|
对,其实上面的说的是正确的。如果不想贡献的话,还可以用var ssdb = new SSDB.connect();的方法来新建新的实例。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
上一版本的代码不支持同时连接多个ssdb,原因是因为net连接的部分作为一个module的普通方法,被进程中的其他js共用了,因此申明多个连接时前面的net连接会被后面的覆盖。
解决:
参照redis nodejs client,将net连接及监听的代码独立出来,每次connect的时候new 一个实例,同时支持多个连接,直接在SSDB.js上修改,调用方式不变。