Skip to content

Commit

Permalink
Merge pull request #173 from samply/fix/readme-sql-task
Browse files Browse the repository at this point in the history
changed query in SQL task in readme
  • Loading branch information
enola-dkfz authored Oct 14, 2024
2 parents 2bb6afe + c976254 commit f316288
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ POSTGRES_CONNECTION_STRING = "postgresql://postgres:Test.123@localhost:5432/post

Additionally when using Postgres this optional variable can be set:
```bash
MAX_DB_ATTEMPTS = "8" # Max number of attempts to connect to the database, default value: 8
MAX_DB_ATTEMPTS = "8" # Max number of attempts to connect to the database; default value: 8
```

Obfuscating zero counts is by default switched off. To enable obfuscating zero counts, set the env. variable `OBFUSCATE_ZERO`.
Expand Down Expand Up @@ -92,7 +92,7 @@ curl -v -X POST -H "Content-Type: application/json" --data '{"id":"7fffefff-ffef

Creating a sample SQL task for a `SELECT_TEST` query using curl:
```bash
curl -v -X POST -H "Content-Type: application/json" --data '{"id":"7fffefff-ffef-fcff-feef-feffffffffff","from":"app1.proxy1.broker","to":["app1.proxy1.broker"],"ttl":"10s","failure_strategy":{"retry":{"backoff_millisecs":1000,"max_tries":5}},"metadata":{"project":"exliquid"},"body":"eyJwYXlsb2FkIjoiU0VMRUNUX1RBQkxFUyJ9"}' -H "Authorization: ApiKey app1.proxy1.broker App1Secret" http://localhost:8081/v1/tasks
curl -v -X POST -H "Content-Type: application/json" --data '{"id":"7fffefff-ffef-fcff-feef-feffffffffff","from":"app1.proxy1.broker","to":["app1.proxy1.broker"],"ttl":"10s","failure_strategy":{"retry":{"backoff_millisecs":1000,"max_tries":5}},"metadata":{"project":"exliquid"},"body":"eyJwYXlsb2FkIjoiU0VMRUNUX1RFU1QifQ=="}' -H "Authorization: ApiKey app1.proxy1.broker App1Secret" http://localhost:8081/v1/tasks
```

Creating a sample [Exporter](https://github.com/samply/exporter) "execute" task containing an Exporter query using curl:
Expand Down
4 changes: 2 additions & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct SqlQuery {

include!(concat!(env!("OUT_DIR"), "/sql_replace_map.rs"));

pub async fn get_pg_connection_pool(pg_url: &str, max_attempts: u32) -> Result<PgPool, FocusError> {
pub async fn get_pg_connection_pool(pg_url: &str, max_db_attempts: u32) -> Result<PgPool, FocusError> {
info!("Trying to establish a PostgreSQL connection pool");

tryhard::retry_fn(|| async {
Expand All @@ -28,7 +28,7 @@ pub async fn get_pg_connection_pool(pg_url: &str, max_attempts: u32) -> Result<P
FocusError::CannotConnectToDatabase(e.to_string())
})
})
.retries(max_attempts)
.retries(max_db_attempts)
.exponential_backoff(Duration::from_secs(2))
.await
}
Expand Down

0 comments on commit f316288

Please sign in to comment.