-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eedc91
commit 56d5348
Showing
37 changed files
with
1,895 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/infra/client/isolate-v8-runner/Dockerfile.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
* | ||
|
||
!packages/infra/pegboard/runner-protocol | ||
!packages/infra/pegboard/v8-isolate-runner/Cargo.toml | ||
!packages/infra/pegboard/v8-isolate-runner/src | ||
!packages/infra/client/runner-protocol | ||
!packages/infra/client/isolate-v8-runner/Cargo.toml | ||
!packages/infra/client/isolate-v8-runner/src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
use std::{path::Path, result::Result::Ok, time::Duration}; | ||
|
||
use anyhow::*; | ||
use foundationdb::{self as fdb, options::DatabaseOption}; | ||
|
||
pub fn var(name: &str) -> Result<String> { | ||
std::env::var(name).context(name.to_string()) | ||
} | ||
|
||
pub fn fdb_handle() -> fdb::FdbResult<fdb::Database> { | ||
let cluster_file_path = Path::new("/etc/foundationdb/fdb.cluster"); | ||
let db = fdb::Database::from_path(&cluster_file_path.display().to_string())?; | ||
db.set_option(DatabaseOption::TransactionRetryLimit(10))?; | ||
|
||
Ok(db) | ||
} | ||
|
||
pub async fn fdb_health_check() -> Result<()> { | ||
let db = fdb_handle()?; | ||
|
||
loop { | ||
match tokio::time::timeout( | ||
Duration::from_secs(3), | ||
db.run(|trx, _maybe_committed| async move { Ok(trx.get(b"", false).await?) }), | ||
) | ||
.await | ||
{ | ||
Ok(res) => { | ||
res?; | ||
} | ||
Err(_) => eprintln!("db missed ping"), | ||
} | ||
|
||
tokio::time::sleep(Duration::from_secs(3)).await; | ||
} | ||
} |
Oops, something went wrong.