Skip to content

Fix notification cache paging with snowflake-like ids

https://en.wikipedia.org/wiki/Snowflake_ID

Notification cache id is changed to snowflake-like id, which is concatenation of the following fields:

sign bit     1 bit
timestamp    35 bits
type_id      6 bits
counter      22 bits

timestamp is offset to start at 2016-03-24T16:00:00, which is the HIVE_GENESIS_TIME. 35 bits is enough for 1000 years, since we only use seconds:

log2(1e3365.25246060) = ~34.87726843940377862696

This makes the IDs both deterministic and sortable.

Notification IDs are now always returned as strings by API, so that JSON parsers won't treat them as floats.

Merge request reports

Loading