fix: invite code snowflake id collisions
This commit is contained in:
parent
253f11b00c
commit
339aa59434
2 changed files with 3 additions and 1 deletions
|
@ -578,7 +578,7 @@
|
|||
|
||||
document.getElementById(\"invite_codes_output\").classList.remove(\"hidden\");
|
||||
document.getElementById(\"invite_codes_error_output\").classList.remove(\"hidden\");
|
||||
document.getElementById(\"invite_codes_output\").children[0].innerText = \"Working...\";
|
||||
document.getElementById(\"invite_codes_output\").children[0].innerText = \"Working... expect to wait 50ms per invite code\";
|
||||
|
||||
fetch(`/api/v1/invites/${count}`, {
|
||||
method: \"POST\",
|
||||
|
|
|
@ -855,6 +855,8 @@ pub async fn generate_invite_codes_request(
|
|||
let mut errors_string = String::new();
|
||||
|
||||
for _ in 0..count {
|
||||
// ids will quickly collide, so we need to wait a bit so timestamps are different
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
match data
|
||||
.create_invite_code(InviteCode::new(user.id), &user)
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue