You've already forked AstralRinth
forked from didirus/AstralRinth
New Creator Notifications (#4383)
* Some new notification types * Fix error * Use existing DB models rather than inline queries * Fix template fillout * Fix ModerationThreadMessageReceived * Insert more notifications, fix some formatting * chore: query cache, clippy, fmt * chore: query cache, clippy, fmt * Use outer transactions to insert notifications instead of creating a new one * Join futures
This commit is contained in:
committed by
GitHub
parent
8149618187
commit
6da190ed01
@@ -60,12 +60,15 @@ macro_rules! generate_bulk_ids {
|
||||
count: usize,
|
||||
con: &mut sqlx::Transaction<'_, sqlx::Postgres>,
|
||||
) -> Result<Vec<$return_type>, DatabaseError> {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut retry_count = 0;
|
||||
|
||||
// Check if ID is unique
|
||||
loop {
|
||||
let base = random_base62_rng_range(&mut rng, 1, 10) as i64;
|
||||
// We re-acquire a thread-local RNG handle for each uniqueness loop for
|
||||
// the bulk generator future to be `Send + Sync`.
|
||||
let base =
|
||||
random_base62_rng_range(&mut rand::thread_rng(), 1, 10)
|
||||
as i64;
|
||||
let ids =
|
||||
(0..count).map(|x| base + x as i64).collect::<Vec<_>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user