[MSN-1990] Use env var to limit eta task #50
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
In our current implementation of the later method, we do not have a mechanism to enforce a maximum allowable delay time for task scheduling. This can lead to tasks being scheduled far into the future, which might not be desirable or could cause unexpected behavior in our application. To address this, we need to introduce a check that ensures the delay time does not exceed a specified maximum value.
Issues
https://nilosaude.atlassian.net/browse/MSN-1989
Solution
This pull request introduces a new check within the later method to enforce a maximum allowable delay time for task scheduling. The maximum delay time is configurable through the MAXIMUM_ETA_TASK setting in Django. If the MAXIMUM_ETA_TASK setting is defined and the calculated delay exceeds this value, the method raises a ValueError indicating the delay time is invalid.
By adding this check, we ensure that the task scheduling respects the maximum delay time configured in our settings, thereby preventing tasks from being scheduled too far into the future.