Merge branch 'main' into glitch-soc/merge-upstream

Conflicts:
- `Gemfile.lock`:
  Not a real conflict, upstream-updated dependency (redis) textually too
  close to glitch-soc-only dependecy.
  Updated redis gem like upstream did.
This commit is contained in:
Claire
2021-08-09 23:25:49 +02:00
37 changed files with 1609 additions and 199 deletions

View File

@ -138,10 +138,11 @@ module Mastodon::Snowflake
end
end
def id_at(timestamp)
id = timestamp.to_i * 1000 + rand(1000)
def id_at(timestamp, with_random: true)
id = timestamp.to_i * 1000
id += rand(1000) if with_random
id = id << 16
id += rand(2**16)
id += rand(2**16) if with_random
id
end