retry pgloader up to 5x (#1845)

This commit is contained in:
Aiden McClelland
2022-09-29 13:45:28 -06:00
committed by GitHub
parent 71b19e6582
commit afb4536247
3 changed files with 17 additions and 3 deletions

View File

@@ -100,7 +100,14 @@ 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() {
pgloader(&old_db_path).await?;
let mut res = Ok(());
for _ in 0..5 {
res = pgloader(&old_db_path).await;
if res.is_ok() {
break;
}
}
res?
}
Ok(secret_store)
}

View File

@@ -141,7 +141,14 @@ impl SetupContext {
.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() {
pgloader(&old_db_path).await?;
let mut res = Ok(());
for _ in 0..5 {
res = pgloader(&old_db_path).await;
if res.is_ok() {
break;
}
}
res?
}
Ok(secret_store)
}

View File

@@ -2,7 +2,7 @@
"name": null,
"auto-check-updates": true,
"pkg-order": [],
"ack-welcome": "0.3.0",
"ack-welcome": "0.3.2",
"marketplace": {
"selected-id": null,
"known-hosts": {}