Closed
Description
Hello @s3rius! Thank you for creating taskiq.
I encountered an exception (something like AttributeError: 'bool' object has no attribute 'lower'
) with taskiq
when attempting to use my custom SimpleRetryMiddleware
. The problem occurred with the following code:
@taskiq_broker.task(retry_on_error=True)
async def _process_not_reached_deal(deal_details: BitrixDealResultData) -> Optional[bool]:
Unfortunately, I don't have the full traceback of the exception to provide for troubleshooting.
I've implemented a fix, and the code is now working correctly:
_LABEL_PARSERS: Dict[LabelType, Callable[[str], Any]] = {
LabelType.INT: int,
LabelType.STR: str,
LabelType.FLOAT: float,
LabelType.BOOL: lambda x: str(x).lower() == "true",
LabelType.BYTES: base64.b64decode,
LabelType.ANY: lambda x: x,
}
However, I'm not entirely sure if the boolean value conversion logic (lambda x: str(x).lower() == "true") is the most appropriate approach. I'd appreciate your thoughts on this implementation.
Metadata
Metadata
Assignees
Labels
No labels