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

Possible Issue with store.close() when using SSHTunnel #496

Open
sivonxay opened this issue Oct 7, 2021 · 0 comments
Open

Possible Issue with store.close() when using SSHTunnel #496

sivonxay opened this issue Oct 7, 2021 · 0 comments

Comments

@sivonxay
Copy link
Contributor

sivonxay commented Oct 7, 2021

See example below for context. Not sure if this is intended behavior or a bug, since forcing a reconnect fixes the issue.

from maggma.stores.mongolike import MongoStore

store = MongoStore(<credentials/etc here>) 
store.connect()
store.query_one({}) # This works fine and has no issues
store.close()

# Since MongoStore.close() does not clear the MongoStore._collection variable, calling connect() does nothing
store.connect() 
# This query is fine if SSHTunnels are not in use, since the connection to the DB is 
# automatically reopened by MongoClient. If SSHTunnel is used, the connection to 
# the not work, since the SSHTunnel connection was already closed
test_doc = store.query_one({})  

# This works, as the connection to the SSHTunnel is re-established
store.connect(force_reset=True) 
test_doc = store.query_one({}) 
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

1 participant