Przeglądaj źródła

[MongoDB] mongo_host must be a list

Ask Solem 9 lat temu
rodzic
commit
511f008540
1 zmienionych plików z 3 dodań i 2 usunięć
  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