feat: scrape all player record
This commit is contained in:
@@ -10,10 +10,7 @@ use serde::Serialize;
|
||||
use spdlog::{error, info};
|
||||
|
||||
use sdgb_api::title::MaiVersionExt;
|
||||
use sdgb_api::title::{
|
||||
Sdgb1_50,
|
||||
methods::{APIExt, HasUid},
|
||||
};
|
||||
use sdgb_api::title::{Sdgb1_50, methods::APIExt};
|
||||
use sdgb_api::{ApiError, bincode};
|
||||
|
||||
use bincode::{BorrowDecode, Encode, borrow_decode_from_slice};
|
||||
@@ -87,7 +84,7 @@ pub async fn cached_concurrent_fetch<A: APIExt>(
|
||||
) -> Result<(), Box<dyn snafu::Error>>
|
||||
where
|
||||
A::Payload: From<u32>,
|
||||
A::Response: Encode + for<'a> BorrowDecode<'a, ()> + HasUid,
|
||||
A::Response: Encode + for<'a> BorrowDecode<'a, ()>,
|
||||
{
|
||||
cached_concurrent_fetch_userfn(
|
||||
user_ids,
|
||||
@@ -109,7 +106,7 @@ pub async fn cached_concurrent_fetch_userfn<R>(
|
||||
scrape: impl AsyncFn(&AsyncClient, u32) -> Result<R, ApiError>,
|
||||
) -> Result<(), Box<dyn snafu::Error>>
|
||||
where
|
||||
R: Encode + for<'a> BorrowDecode<'a, ()> + HasUid,
|
||||
R: Encode + for<'a> BorrowDecode<'a, ()>,
|
||||
{
|
||||
let _ = cache::init_db();
|
||||
|
||||
@@ -150,7 +147,7 @@ where
|
||||
if let Ok(mut table) = cache::open_table(&write, definition)
|
||||
&& let Ok(encoded) = encode_to_vec(resp, config)
|
||||
{
|
||||
_ = table.insert(resp.get_uid(), encoded);
|
||||
_ = table.insert(user_id, encoded);
|
||||
}
|
||||
}
|
||||
Err(sdgb_api::ApiError::JSON { .. }) => {}
|
||||
|
||||
Reference in New Issue
Block a user