Pass WriteType, not str to RetryPolicy.on_write_timeout

Fixes #123
This commit is contained in:
Tyler Hobbs
2014-05-20 13:32:58 -05:00
parent 8908600c83
commit ae684f05b4
3 changed files with 13 additions and 1 deletions

View File

@@ -10,6 +10,9 @@ Bug Fixes
---------
* Don't strip trailing underscores from column names when using the
named_tuple_factory (PYTHON-56)
* Pass WriteType instance to RetryPolicy.on_write_timeout() instead
of the string name of the write type. This caused write timeout
errors to always be rethrown instead of retrying. (github #123)
1.1.2
=====

View File

@@ -43,6 +43,7 @@ from cassandra.cqltypes import (AsciiType, BytesType, BooleanType,
InetAddressType, IntegerType, ListType,
LongType, MapType, SetType, TimeUUIDType,
UTF8Type, UUIDType, lookup_casstype)
from cassandra.policies import WriteType
log = logging.getLogger(__name__)
@@ -291,7 +292,7 @@ class WriteTimeoutErrorMessage(RequestExecutionException):
'consistency': read_consistency_level(f),
'received_responses': read_int(f),
'required_responses': read_int(f),
'write_type': read_string(f),
'write_type': WriteType.name_to_value[read_string(f)],
}
def to_exception(self):

View File

@@ -568,6 +568,14 @@ class WriteType(object):
internally before a BATCH write.
"""
WriteType.name_to_value = {
'SIMPLE': WriteType.SIMPLE,
'BATCH': WriteType.BATCH,
'UNLOGGED_BATCH': WriteType.UNLOGGED_BATCH,
'COUNTER': WriteType.COUNTER,
'BATCH_LOG': WriteType.BATCH_LOG,
}
class RetryPolicy(object):
"""