mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-16 07:18:54 +00:00
Parallelize list_pages beatmap name fetching
This commit is contained in:
parent
1c3b6a7cb2
commit
85e553673e
1 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@ use crate::{
|
|||
request::{BeatmapRequestKind, UserID},
|
||||
Client as OsuHttpClient,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use serenity::{
|
||||
framework::standard::{
|
||||
macros::{command, group},
|
||||
|
@ -242,7 +243,7 @@ fn list_plays(plays: &[Score], mode: Mode, ctx: Context, m: &Message) -> Command
|
|||
let plays = &plays[start..end];
|
||||
let beatmaps = {
|
||||
let b = &mut beatmaps[start..end];
|
||||
b.iter_mut().enumerate().map(
|
||||
b.par_iter_mut().enumerate().map(
|
||||
|(i, v)| v.get_or_insert_with(
|
||||
|| osu.beatmaps(BeatmapRequestKind::Beatmap(plays[i].beatmap_id), |f| f)
|
||||
.ok()
|
||||
|
|
Loading…
Add table
Reference in a new issue