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

cap max creation time used in ranking calculation #630

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

asdfzdfj
Copy link
Contributor

@asdfzdfj asdfzdfj commented Mar 25, 2024

added a cap on creation timestamp used in ranking calculation to not exceeds the current time while performing calculation to cope with posts' that have funny created date far into the future, also cap the final score value to not exceed int32 max size (2**31 - 1)

the current ranking function involves using the posts' object creation timestamp as part of the calculation, but if the datetime is too far in the future (e.g. 4200-06-09, as seen in this example), it can cause the ranking score value to exceeds the ranking score field size, which appears to be int32 sized

technically we'll still be running into year 2038 problem on this field, but there's some discussion on adjusting the ranking score and keep that below int32 sized altogether, so that's left for the future exercise

also see #622 for more context, this only deals with a specific problem that's observed from that issue but by no means a definitive solution for the problem

added a cap on creation timestamp used in ranking calculation to not
exceeds the current time while performing calculation to cope with
posts' that have funny created date far into the future, also cap the
final score value to not exceed int32 max size (2**31 - 1)

the current ranking function involves using the posts' object creation
timestamp as part of the calculation, but if the datetime is too far in
the future (e.g. 4200-06-09, as seen in [this example][ex1]), it can
cause the ranking score value to exceeds the ranking score field size,
which appears to be int32 sized

technically we'll still be running into year 2038 problem on this field,
but there're some discusstions on adjusting the ranking score and keep
that below int32 sized altogether, so that's left for the future exercise

[ex1]: https://myfriendsare.gay/notice/APx5K7aeglknMfm1A0
@asdfzdfj asdfzdfj force-pushed the fix/ranking-score-exceeds-int32-cap branch from 9a7eb63 to 622d33c Compare March 25, 2024 11:41
@asdfzdfj asdfzdfj merged commit b0a3abf into main Mar 25, 2024
7 checks passed
@asdfzdfj asdfzdfj deleted the fix/ranking-score-exceeds-int32-cap branch March 25, 2024 11:48
@melroy89 melroy89 added backend Backend related issues and pull requests enhancement New feature or request labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants