Skip to content

Uncomment Clone method that was definitely commented by mistake#427

Open
yehor-manzhula wants to merge 1 commit into
upper:masterfrom
yehor-manzhula:hotfix/fix-clone-method
Open

Uncomment Clone method that was definitely commented by mistake#427
yehor-manzhula wants to merge 1 commit into
upper:masterfrom
yehor-manzhula:hotfix/fix-clone-method

Conversation

@yehor-manzhula

@yehor-manzhula yehor-manzhula commented Jan 2, 2018

Copy link
Copy Markdown

It seems that a typo was made, and at the moment it's just impossible to clone session that is strongly affect performance.
@xiam Could you please take a look at it?

@xiam

xiam commented Jan 6, 2018

Copy link
Copy Markdown
Member

@egor-manjula good finding! I'll review/merge as soon as I fix travis.

@xiam

xiam commented Jan 7, 2018

Copy link
Copy Markdown
Member

@egor-manjula travis is fixed now, could you elaborate a bit more on the performance problems you're experimenting and how does Clone() fix them? Also please make sure CI is passing.

@yehor-manzhula

Copy link
Copy Markdown
Author

@xiam Clone method allows to clone already existing session to new one without connecting to database once again that is why without such method each request need to reconnect to db to have its own session, that takes additional time - that is what I meant under performance issue.

@xiam

xiam commented Jan 8, 2018

Copy link
Copy Markdown
Member

@egor-manjula It's not necessary to reconnect to the database frequently, we usually work with one long running session (you can put the session on a package and export it), each session manages its own pool of connections. Can you try to use one exported session? If that does not solve your case, please elaborate a bit more on why you need to reconnect so often.

@yehor-manzhula

Copy link
Copy Markdown
Author

@xiam Using package variable is not the case I want get. There is discussion on that here:
https://github.com/go-mgo/mgo/issues/287

In few words I want to Clone session on middleware layer, that session that is already in package variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants