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

Change type of event duration in DB from i32 to i64 #986

Merged
merged 1 commit into from
Nov 8, 2023

Conversation

LukasKalbertodt
Copy link
Member

A recent change to the Tobira module in OC changed how durations are acquired. Before, the duration of our "always live" events was reported as 0. But now the "correct" duration is reported, i.e. the difference between start and end time. That's many years. 2^31 ms are roughly 25 days. So this broke for our live events. Note that I had to really try convince Opencast of even creating this live event with more than 24h between start and end time. So I would bet that out there, there is no Opencast event longer than 25 days.

Unfortunately, Juniper does not support i64 as scalar type. That's partially ... correct. JSON does in principle only support f64 numbers as that's what JS is using. But since JSON is text and the numbers are decimal numbers, no one stops you from writing a number to JSON that is not representable as f64. And apparently this is sometimes done. Either way, we now cast the i64 to f64 for the API. Note that f64 can exactly represent integers up to 2^53. That in ms is 285 thousand years. Also note that the duration from Opencast is also transmitted to us via JSON.

So while this whole situation is not ideal, it's healthy to remember that basically no event out there will ever run into this situation and I there are no real world events for which the "i64 to f64" conversion is not exact.

I am also aware that our live streams currently say "Duration 2431753:00:00". But let's not worry about this. If there are actual uses of >24h events out there, we can still improve that part.

A recent change to the Tobira module in OC changed how durations are
acquired. Before, the duration of our "always live" events was reported
as 0. But now the "correct" duration is reported, i.e. the difference
between start and end time. That's many years. 2^31 ms are roughly 25
days. So this broke for our live events. Note that I had to really try
convince Opencast of even creating this live event with more than 24h
between start and end time. So I would bet that out there, there is no
Opencast event longer than 25 days.

Unfortunately, Juniper does not support i64 as scalar type. That's
partially ... correct. JSON does in principle only support f64 numbers
as that's what JS is using. But since JSON is text and the numbers are
decimal numbers, no one stops you from writing a number to JSON that is
not representable as f64. And apparently this is sometimes done. Either
way, we now cast the i64 to f64 for the API. Note that f64 can exactly
represent integers up to 2^53. That in ms is 285 thousand years. Also
note that the duration from Opencast is also transmitted to us via JSON.

So while this whole situation is not ideal, it's healthy to remember
that basically no event out there will ever run into this situation and
I there are no real world events for which the "i64 to f64" conversion
is not exact.

I am also aware that our live streams currently say
"Duration 2431753:00:00". But let's not worry about this. If there are
actual uses of >24h events out there, we can still improve that part.
@LukasKalbertodt LukasKalbertodt added the changelog:dev Changes primarily for developers label Nov 8, 2023
@github-actions github-actions bot temporarily deployed to test-deployment-pr986 November 8, 2023 11:40 Destroyed
@owi92 owi92 merged commit fb45850 into elan-ev:master Nov 8, 2023
3 checks passed
@LukasKalbertodt LukasKalbertodt deleted the fix-duration-harvesting branch November 8, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:dev Changes primarily for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants