Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2585

moped config options

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.15
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I report some problems on moped options I experienced.

      1. Can't change moped options on mongoid.yml

      moped takes some options for retrying.
      https://github.com/mongoid/moped/blob/master/lib/moped/cluster.rb#L105-L108

      However there is no way to change those default value from mongoid.yml. I tried a config like this:

      development:
        sessions:
          default:
            database: mongd_test
            hosts: 
              - localhost:27017
            options:
              safe: true
              max_retries: 2
              retry_interval: 0.5
      

      mongoid sends those options (max_retries and retry_interval) but keys of hash object are string despite moped expects symbol.

      https://github.com/mongoid/moped/blob/master/lib/moped/cluster.rb#L57

      2. Default value for max_retries and retry_interval

      Default value of max_retries is 30 (times) and retry_interval is 1 (second). I think that it is way too many as a default value. It means that you have to wait for 30 seconds until moped throw an exception when mongodb is down. If you use mongoid on web application, all requests would be queued up during the time. That would make the situation worse.

      This is very useful feature since mongodb resets connection when replicaset configuration is changed. However I suggest to set max_retries=1 and retry_interval=0.1 as their default values.

      3. Documentation

      It will be nice if those values are described at:
      http://mongoid.org/en/mongoid/docs/installation.html#configuration


      What do you think? I am happy to write patches and submit pull-requests for 1 and 2 if you want.

      Thanks!

            Assignee:
            Unassigned Unassigned
            Reporter:
            ono ono
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: