Skip to content

Commit 144da4e

Browse files
author
Luke Bakken
committed
streaming_op may not be initialized if make_op throws an exception
1 parent b85d3b4 commit 144da4e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

riak/client/transport.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def _stream_with_retry(self, make_op):
106106
while True:
107107
resource = self._acquire()
108108
transport = resource.object
109+
streaming_op = None
109110
try:
110111
streaming_op = make_op(transport)
111112
streaming_op.attach(resource)
@@ -122,7 +123,8 @@ def _stream_with_retry(self, make_op):
122123
raise
123124
finally:
124125
first_try = False
125-
streaming_op.close()
126+
if streaming_op:
127+
streaming_op.close()
126128

127129
def _with_retries(self, pool, fn):
128130
"""

0 commit comments

Comments
 (0)