Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import gevent.monkey
import time
import pymongo
connection = pymongo.Connection(use_greenlets=True)
def task():
collection = connection.autoref.all_cars
# Make cursor, and make sure it opens a socket
cursor = collection.find()
# Supposedly return this socket to the pool
if __name__ == "__main__":
jobs = [gevent.spawn(task) for i in xrange(500)]

This comment has been minimized.

Copy link

commented Oct 21, 2013

I have read your discussion in Google online forum. Is this the correct usage of gevent with pymongo?
Or, Hopefully, I'm new to pymongo, do you have any other examples of the gevent with pymongo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.