flamingo-run / django-cloud-tasks

It's like Celery, but with Serverless Google Cloud products.
Apache License 2.0
46 stars 12 forks source link

[MSN-2689] fix: cast env var values according to its type #53

Closed iasmini closed 3 months ago

iasmini commented 3 months ago

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):

if max_eta_task is not None and delay_in_seconds > max_eta_task:
...
TypeError: '>' not supported between instances of 'int' and 'str'

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.

codeclimate[bot] commented 3 months ago

Code Climate has analyzed commit 64e498dd and detected 0 issues on this pull request.

View more on Code Climate.