mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 15:45:36 +01:00
Add update lock
This commit is contained in:
@@ -259,7 +259,16 @@ async fn send_webhooks() -> Result<(), Box<reqwest::Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
pub static ref UPDATE_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::new(());
|
||||
}
|
||||
|
||||
pub async fn update() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let _lock = match UPDATE_LOCK.try_lock() {
|
||||
Ok(v) => v,
|
||||
Err(err) => return Err(Box::new(err)),
|
||||
};
|
||||
|
||||
log::info!("Start update...");
|
||||
|
||||
let pool = match get_postgres_pool().await {
|
||||
|
||||
Reference in New Issue
Block a user