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:
parent
c07e5b835e
commit
83279e0253
@ -1,5 +1,6 @@
|
|||||||
use crate::config::{ClientConfig, Profile};
|
use crate::config::{ClientConfig, Profile};
|
||||||
use crate::task::run;
|
use crate::task::run;
|
||||||
|
use common::strings::REGION_NOT_FOUND;
|
||||||
use communicator::{ClientManager, Identity, TunnelEndpoint, TunnelListener, connect_tunnel};
|
use communicator::{ClientManager, Identity, TunnelEndpoint, TunnelListener, connect_tunnel};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::{LevelFilter, error, info};
|
use log::{LevelFilter, error, info};
|
||||||
@ -179,6 +180,9 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
if error.to_string().contains(REGION_NOT_FOUND) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
error!("{}", error);
|
error!("{}", error);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
pub mod stream;
|
pub mod stream;
|
||||||
pub mod updater;
|
pub mod updater;
|
||||||
pub mod http;
|
pub mod http;
|
||||||
|
pub mod strings;
|
||||||
1
common/src/strings.rs
Normal file
1
common/src/strings.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub static REGION_NOT_FOUND: &str = "region not found";
|
||||||
@ -1,14 +1,14 @@
|
|||||||
use crate::{CONFIG, SESSION_STORE};
|
use crate::{CONFIG, SESSION_STORE};
|
||||||
use assets_updater::core::asset_execution::{
|
use assets_updater::core::asset_execution::{AssetExecutionContext, should_download_bundle};
|
||||||
should_download_bundle, AssetExecutionContext,
|
use assets_updater::core::errors::RegionError;
|
||||||
};
|
|
||||||
use assets_updater::core::regions::select_region;
|
use assets_updater::core::regions::select_region;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use common::http::SyncResponse;
|
use common::http::SyncResponse;
|
||||||
|
use common::strings::REGION_NOT_FOUND;
|
||||||
use common::updater::SyncContext;
|
use common::updater::SyncContext;
|
||||||
use communicator::http::{json_from_request, send, send_error};
|
use communicator::http::{json_from_request, send, send_error};
|
||||||
use h2::server::SendResponse;
|
|
||||||
use h2::RecvStream;
|
use h2::RecvStream;
|
||||||
|
use h2::server::SendResponse;
|
||||||
use http::Request;
|
use http::Request;
|
||||||
|
|
||||||
pub async fn sync_route(
|
pub async fn sync_route(
|
||||||
@ -24,6 +24,15 @@ pub async fn sync_route(
|
|||||||
|
|
||||||
let region = select_region(&CONFIG.updater_config, &sync_context.region);
|
let region = select_region(&CONFIG.updater_config, &sync_context.region);
|
||||||
if let Err(error) = 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());
|
send_error(send_response, error.into());
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@ -52,4 +61,3 @@ pub async fn sync_route(
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user