1
0
mirror of https://github.com/Bluemangoo/sekai-unpacker.git synced 2026-05-06 20:44:47 +08:00

do not retry on region not found

This commit is contained in:
Bluemangoo 2026-04-14 17:28:47 +08:00
parent c07e5b835e
commit 83279e0253
Signed by: Bluemangoo
GPG Key ID: F2F7E46880A1C4CF
4 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,6 @@
use crate::config::{ClientConfig, Profile};
use crate::task::run;
use common::strings::REGION_NOT_FOUND;
use communicator::{ClientManager, Identity, TunnelEndpoint, TunnelListener, connect_tunnel};
use lazy_static::lazy_static;
use log::{LevelFilter, error, info};
@ -179,6 +180,9 @@ async fn main() -> anyhow::Result<()> {
.await;
}
Err(error) => {
if error.to_string().contains(REGION_NOT_FOUND) {
return;
}
error!("{}", error);
}
_ => {}

View File

@ -1,3 +1,4 @@
pub mod stream;
pub mod updater;
pub mod http;
pub mod strings;

1
common/src/strings.rs Normal file
View File

@ -0,0 +1 @@
pub static REGION_NOT_FOUND: &str = "region not found";

View File

@ -1,14 +1,14 @@
use crate::{CONFIG, SESSION_STORE};
use assets_updater::core::asset_execution::{
should_download_bundle, AssetExecutionContext,
};
use assets_updater::core::asset_execution::{AssetExecutionContext, should_download_bundle};
use assets_updater::core::errors::RegionError;
use assets_updater::core::regions::select_region;
use bytes::Bytes;
use common::http::SyncResponse;
use common::strings::REGION_NOT_FOUND;
use common::updater::SyncContext;
use communicator::http::{json_from_request, send, send_error};
use h2::server::SendResponse;
use h2::RecvStream;
use h2::server::SendResponse;
use http::Request;
pub async fn sync_route(
@ -24,6 +24,15 @@ pub async fn sync_route(
let region = select_region(&CONFIG.updater_config, &sync_context.region);
if let Err(error) = region {
if let RegionError::NotFound(_) = &error {
send(
send_response,
500,
"text/plain",
format!("{}: {}", REGION_NOT_FOUND, error),
);
return Ok(());
}
send_error(send_response, error.into());
return Ok(());
}
@ -52,4 +61,3 @@ pub async fn sync_route(
Ok(())
}