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

Uncomment Clone method that was definitely commented by mistake #427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yehor-manzhula
Copy link

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

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
Copy link
Member

xiam commented Jan 6, 2018

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

@xiam
Copy link
Member

xiam commented Jan 7, 2018

@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
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
Copy link
Member

xiam commented Jan 8, 2018

@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
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