You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
I can not find the method closed conntions,when I run program, the conntions growing fast until mongodb conntions full and then I can not connect to mongodb, how can I close connections?
The text was updated successfully, but these errors were encountered:
@sushuai It's simple to close connections opened by MongoKit. Here are my solution:
# create a connection
connection = Connection()
# do something
...
# close the connection
connection.close()
And even more, if you use MongoKit in a Flask-RESTful project, it's also very simple to close connections opened by each API request:
from flask import Flask
from flask_restful import Api
app = Flask(__name__)
api = Api(app)
@app.teardown_request
def teardown_request(exception): # close db connection after each api request
connection.close()
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I can not find the method closed conntions,when I run program, the conntions growing fast until mongodb conntions full and then I can not connect to mongodb, how can I close connections?
The text was updated successfully, but these errors were encountered: