mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
disable concurrency and delete tmpdir before retry (#1846)
* disable concurrency and delete tmpdir before retry * undo retry * really limit usage of pgloader * configurable * no migrate notifications
This commit is contained in:
@@ -41,6 +41,8 @@ use crate::{Error, ErrorKind, ResultExt};
|
||||
#[derive(Debug, Default, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct RpcContextConfig {
|
||||
pub migration_batch_rows: Option<usize>,
|
||||
pub migration_prefetch_rows: Option<usize>,
|
||||
pub bind_rpc: Option<SocketAddr>,
|
||||
pub bind_ws: Option<SocketAddr>,
|
||||
pub bind_static: Option<SocketAddr>,
|
||||
@@ -100,14 +102,12 @@ impl RpcContextConfig {
|
||||
.with_kind(crate::ErrorKind::Database)?;
|
||||
let old_db_path = self.datadir().join("main/secrets.db");
|
||||
if tokio::fs::metadata(&old_db_path).await.is_ok() {
|
||||
let mut res = Ok(());
|
||||
for _ in 0..5 {
|
||||
res = pgloader(&old_db_path).await;
|
||||
if res.is_ok() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
res?
|
||||
pgloader(
|
||||
&old_db_path,
|
||||
self.migration_batch_rows.unwrap_or(25000),
|
||||
self.migration_prefetch_rows.unwrap_or(100_000),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
Ok(secret_store)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user