The value of the environment variable was being retrieved as a string, even if it was set to None. This led to the following error when attempting to compare an integer (delay_in_seconds) with a string (max_eta_task):
if max_eta_task is not None and delay_in_seconds > max_eta_task:
...
TypeError: '>' not supported between instances of 'int' and 'str'
To resolve this issue, we cast the environment variable to the appropriate type using specific methods according to its type. This ensures that the environment variable is correctly interpreted as an integer, list, or other expected types, preventing type mismatches during comparisons.
Context
The value of the environment variable was being retrieved as a string, even if it was set to None. This led to the following error when attempting to compare an integer (delay_in_seconds) with a string (max_eta_task):
Issues
https://nilosaude.atlassian.net/browse/MSN-2689
Solution
To resolve this issue, we cast the environment variable to the appropriate type using specific methods according to its type. This ensures that the environment variable is correctly interpreted as an integer, list, or other expected types, preventing type mismatches during comparisons.