uploaders
This commit is contained in:
@@ -12,6 +12,7 @@ use crate::{
|
||||
DbPool,
|
||||
api::ClientVersion,
|
||||
status::{Channel, ChannelGroup, ChannelView, FilterOption, Status, StatusResponse},
|
||||
uploaders::UploaderProfile,
|
||||
util::{cache::VideoCache, discord::send_discord_error_report, requester::Requester},
|
||||
videos::{FlexibleNumber, ServerOptions, VideoItem, VideosRequest},
|
||||
};
|
||||
@@ -577,6 +578,53 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run_uploader_provider_guarded<F>(
|
||||
provider_name: &str,
|
||||
context: &str,
|
||||
fut: F,
|
||||
) -> Result<Option<UploaderProfile>, String>
|
||||
where
|
||||
F: Future<Output = Result<Option<UploaderProfile>, String>>,
|
||||
{
|
||||
crate::flow_debug!(
|
||||
"provider uploader guard enter provider={} context={}",
|
||||
provider_name,
|
||||
context
|
||||
);
|
||||
match AssertUnwindSafe(fut).catch_unwind().await {
|
||||
Ok(result) => {
|
||||
crate::flow_debug!(
|
||||
"provider uploader guard exit provider={} context={} matched={}",
|
||||
provider_name,
|
||||
context,
|
||||
result.as_ref().ok().and_then(|value| value.as_ref()).is_some()
|
||||
);
|
||||
result
|
||||
}
|
||||
Err(payload) => {
|
||||
let panic_msg = panic_payload_to_string(payload);
|
||||
crate::flow_debug!(
|
||||
"provider uploader guard panic provider={} context={} panic={}",
|
||||
provider_name,
|
||||
context,
|
||||
&panic_msg
|
||||
);
|
||||
let _ = send_discord_error_report(
|
||||
format!("Provider panic: {}", provider_name),
|
||||
None,
|
||||
Some("Provider Guard"),
|
||||
Some(&format!("context={}; panic={}", context, panic_msg)),
|
||||
file!(),
|
||||
line!(),
|
||||
module_path!(),
|
||||
)
|
||||
.await;
|
||||
schedule_provider_validation(provider_name, context, &panic_msg);
|
||||
Err(panic_msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn report_provider_error(provider_name: &str, context: &str, msg: &str) {
|
||||
let _ = send_discord_error_report(
|
||||
format!("Provider error: {}", provider_name),
|
||||
@@ -868,6 +916,19 @@ pub trait Provider: Send + Sync {
|
||||
cacheDuration: None,
|
||||
})
|
||||
}
|
||||
|
||||
async fn get_uploader(
|
||||
&self,
|
||||
_cache: VideoCache,
|
||||
_pool: DbPool,
|
||||
_uploader_id: Option<String>,
|
||||
_uploader_name: Option<String>,
|
||||
_query: Option<String>,
|
||||
_profile_content: bool,
|
||||
_options: ServerOptions,
|
||||
) -> Result<Option<UploaderProfile>, String> {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, not(hottub_single_provider)))]
|
||||
|
||||
Reference in New Issue
Block a user