aboutsummaryrefslogtreecommitdiffstats
path: root/pysite
diff options
context:
space:
mode:
authorGravatar Christopher Baklid <[email protected]>2018-07-08 10:23:38 +0200
committerGravatar Christopher Baklid <[email protected]>2018-07-08 10:23:38 +0200
commit43f23d008eada5cddbfb52e7d474b68f3b5579c4 (patch)
treeced0353434fdf1a33dabd7622caf14ea6cce919e /pysite
parentRemove space from end of `JAMMERS_ROLE` id in constants.py (diff)
updates docker-compose, changes default rdb port and handles a socket error in service discovery
Diffstat (limited to 'pysite')
-rw-r--r--pysite/database.py2
-rw-r--r--pysite/service_discovery.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/pysite/database.py b/pysite/database.py
index bb0c3415..ddf79a31 100644
--- a/pysite/database.py
+++ b/pysite/database.py
@@ -18,7 +18,7 @@ class RethinkDB:
def __init__(self, loop_type: Optional[str] = "gevent"):
self.host = os.environ.get("RETHINKDB_HOST", "127.0.0.1")
- self.port = os.environ.get("RETHINKDB_PORT", "28016")
+ self.port = os.environ.get("RETHINKDB_PORT", "28015")
self.database = os.environ.get("RETHINKDB_DATABASE", "pythondiscord")
self.log = logging.getLogger(__name__)
self.conn = None
diff --git a/pysite/service_discovery.py b/pysite/service_discovery.py
index 2852c2fb..a03341c4 100644
--- a/pysite/service_discovery.py
+++ b/pysite/service_discovery.py
@@ -16,7 +16,11 @@ def wait_for_rmq():
return False
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
- if sock.connect_ex((RMQ_HOST, RMQ_PORT)) == 0:
- return True
+ try:
+ state = sock.connect_ex((RMQ_HOST, RMQ_PORT))
+ if state == 0:
+ return True
+ except socket.gaierror:
+ pass
time.sleep(0.5)