perf: remove .retain() immediate process
This commit is contained in:
@@ -81,12 +81,14 @@ pub enum Commands {
|
||||
skip_login: bool,
|
||||
},
|
||||
|
||||
/// Scrape all user, read possible id from stdin
|
||||
#[cfg(feature = "fetchall")]
|
||||
ListAllUser {
|
||||
#[arg(short, long, default_value_t = 5)]
|
||||
concurrency: usize,
|
||||
},
|
||||
#[cfg(feature = "fetchall")]
|
||||
/// Scrape B50 data
|
||||
ScrapeAllB50 {
|
||||
#[arg(short, long, default_value_t = 5)]
|
||||
concurrency: usize,
|
||||
@@ -96,6 +98,7 @@ pub enum Commands {
|
||||
#[arg(long, default_value_t = 16500)]
|
||||
max_rating: i64,
|
||||
},
|
||||
/// Scrape Region data
|
||||
#[cfg(feature = "fetchall")]
|
||||
ScrapeAllRegion {
|
||||
#[arg(short, long, default_value_t = 5)]
|
||||
@@ -106,6 +109,7 @@ pub enum Commands {
|
||||
#[arg(long, default_value_t = 16500)]
|
||||
max_rating: i64,
|
||||
},
|
||||
/// Scrape all player record
|
||||
#[cfg(feature = "fetchall")]
|
||||
ScrapeAllRecord {
|
||||
#[arg(short, long, default_value_t = 5)]
|
||||
|
||||
@@ -249,11 +249,13 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
utils::helpers::{cached_concurrent_fetch_userfn, read_cache},
|
||||
};
|
||||
|
||||
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
|
||||
|
||||
let players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
cached_concurrent_fetch_userfn(
|
||||
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
|
||||
players
|
||||
.iter()
|
||||
.filter(|p| p.player_rating >= min_rating && p.player_rating <= max_rating)
|
||||
.map(|p| p.user_id)
|
||||
.collect::<Vec<u32>>(),
|
||||
&client,
|
||||
concurrency,
|
||||
RECORDS,
|
||||
@@ -274,11 +276,13 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
utils::helpers::{cached_concurrent_fetch, read_cache},
|
||||
};
|
||||
|
||||
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
|
||||
|
||||
let players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
cached_concurrent_fetch::<GetUserRatingApiExt>(
|
||||
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
|
||||
players
|
||||
.iter()
|
||||
.filter(|p| p.player_rating >= min_rating && p.player_rating <= max_rating)
|
||||
.map(|p| p.user_id)
|
||||
.collect::<Vec<u32>>(),
|
||||
&client,
|
||||
concurrency,
|
||||
B50,
|
||||
@@ -298,11 +302,13 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
utils::helpers::{cached_concurrent_fetch, read_cache},
|
||||
};
|
||||
|
||||
let mut players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
players.retain(|p| p.player_rating >= min_rating && p.player_rating <= max_rating);
|
||||
|
||||
let players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
cached_concurrent_fetch::<GetUserRegionApiExt>(
|
||||
players.iter().map(|p| p.user_id).collect::<Vec<u32>>(),
|
||||
players
|
||||
.iter()
|
||||
.filter(|p| p.player_rating >= min_rating && p.player_rating <= max_rating)
|
||||
.map(|p| p.user_id)
|
||||
.collect::<Vec<u32>>(),
|
||||
&client,
|
||||
concurrency,
|
||||
REGIONS,
|
||||
|
||||
Reference in New Issue
Block a user