Skip to content

Commit 6c8bd51

Browse files
committed
add connect_timeout inside set_keyspace_blocking
`set_keyspace_blocking` is called from places holding a lock, and in case that the connection is closed from the server side, it might hang forever. using the `connect_timeout` on it to make sure it won't hang forever. Ref: https://github.com/scylladb/scylladb/issues/15661
1 parent 11b3ac1 commit 6c8bd51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cassandra/connection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ def set_keyspace_blocking(self, keyspace):
15091509
query = QueryMessage(query='USE "%s"' % (keyspace,),
15101510
consistency_level=ConsistencyLevel.ONE)
15111511
try:
1512-
result = self.wait_for_response(query)
1512+
result = self.wait_for_response(query, timeout=self.connect_timeout)
15131513
except InvalidRequestException as ire:
15141514
# the keyspace probably doesn't exist
15151515
raise ire.to_exception()

0 commit comments

Comments
 (0)