Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-549

MongoReplicaSetClient should have a proper way to recreate monitors

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.5.2
    • 2.7
    • None
    • Fully Compatible

    Description

      MongoReplicaSetClient uses a MonitorThread to monitor the health of the replica set members. In certain situations, this monitor thread needs to be recreated. Specifically, when using Celery, it clones the main process for each worker, resulting in a situation where the MonitorThread is there, but no longer alive.

      The proper way to handle this situation in Celery is to listen to a worker_process_init signal and re-spawn the thread. However, the MongoReplicaSetClient provides no way of re-spawning the threads without using internal members.

      There should be a simple way of re-spawning these monitors.

      If you want to be super-nice to the community (and Celery is really really popular), you would wire the MongoReplicaSetClient to the Celery worker_process_init signal and re- spawn it yourself, ignoring any ImportErrors for those who do not use Celery, or adding a configurable option to do so. I'd be happy to provide pull requests for either option. LMK if you're interested.

      Attachments

        Activity

          People

            jesse@mongodb.com A. Jesse Jiryu Davis
            zvikico Zviki Cohen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: