Convert task ttl to bigint #812
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.
The max possible ttl is now 9223372036854775807ms or ~292471208.677536 years.
On heartbeat, we calculate the sum of the current time in ms and the ttl value. Because this calculation happens in the database query, there is no good way to clamp this value to avoid overflow. I propose we set reasonable maximums for the following values:
Setting a bound on the current time will actually be pretty easy because we can do it in assert at the top of the tick. We can choose a value so ridiculously large that the clock should never hit it even in a simulation. If this assertion is triggered, it is likely somebody is messing with the machines clock.
Then we would just need to choose a max ttl value such that:
But let's create an issue for this and do it later.