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:
Aiden McClelland
2022-10-04 15:14:15 -06:00
committed by GitHub
parent 1388632562
commit 0c3d0dd525
4 changed files with 34 additions and 20 deletions

View File

@@ -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)
}