Skip to content

Commit

Permalink
Only open the session file for reading.
Browse files Browse the repository at this point in the history
I got into a situation where the get_session method hung.

03:02:06.665541153Z 77794 DEBUG manage [health] node.is_primary end: True
03:02:06.665600545Z 77794 DEBUG manage [health] consul.renew_session start
03:02:06.665630532Z 77794 DEBUG manage [health] consul.get_session start
check.mysql-primary timeout after 10s: '[/usr/local/bin/manage.py health]'
03:02:16.259794109Z check.mysql-primary.kill
  • Loading branch information
dfredell committed May 31, 2018
1 parent ed2a6c9 commit 464f2b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/manager/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_session(self, key=SESSION_NAME, ttl=SESSION_TTL,
if not cached:
return self.create_session(key, ttl)
try:
with open(on_disk, 'r+') as f:
with open(on_disk, 'r') as f:
session_id = f.read()
except IOError:
session_id = self.create_session(key, ttl)
Expand Down

0 comments on commit 464f2b9

Please sign in to comment.