Browse Source

[MongoDB] mongo_host must be a list

Ask Solem 9 năm trước cách đây
mục cha
commit
511f008540
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      celery/backends/mongodb.py

+ 3 - 2
celery/backends/mongodb.py

@@ -86,8 +86,9 @@ class MongoBackend(BaseBackend):
         if self.url:
             uri_data = pymongo.uri_parser.parse_uri(self.url)
             # build the hosts list to create a mongo connection
-            make_host_str = lambda x: "{0}:{1}".format(x[0], x[1])
-            hostslist = map(make_host_str, uri_data['nodelist'])
+            hostslist = [
+                "{0}:{1}".format(x[0], x[1]) for x in uri_data['nodelist']
+            ]
             self.user = uri_data['username']
             self.password = uri_data['password']
             self.mongo_host = hostslist