Skip to content

Commit

Permalink
add connect_timeout inside set_keyspace_blocking
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
fruch committed Nov 9, 2023
1 parent b9035ba commit b756779
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cassandra/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ def set_keyspace_blocking(self, keyspace):
query = QueryMessage(query='USE "%s"' % (keyspace,),
consistency_level=ConsistencyLevel.ONE)
try:
result = self.wait_for_response(query)
result = self.wait_for_response(query, timeout=self.connect_timeout)
except InvalidRequestException as ire:
# the keyspace probably doesn't exist
raise ire.to_exception()
Expand Down

0 comments on commit b756779

Please sign in to comment.