Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

iasmini
Copy link

@iasmini iasmini commented Jul 1, 2024

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.

@iasmini iasmini force-pushed the hotfix/msn-2689-ig-cast-type-env-var-values branch from 22ab541 to 1ba8973 Compare July 1, 2024 18:47
django_cloud_tasks/apps.py Outdated Show resolved Hide resolved
@iasmini iasmini force-pushed the hotfix/msn-2689-ig-cast-type-env-var-values branch from 1ba8973 to efbad60 Compare July 1, 2024 20:42
@iasmini iasmini force-pushed the hotfix/msn-2689-ig-cast-type-env-var-values branch from efbad60 to 64e498d Compare July 1, 2024 20:54
Copy link

codeclimate bot commented Jul 1, 2024

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

View more on Code Climate.

@joaodaher joaodaher merged commit 733232a into flamingo-run:main Jul 2, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants