Skip to content

Commit

Permalink
Increase number of Postgres connexions.
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreLeGuen committed Jan 29, 2024
1 parent bc33880 commit 7532e21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ pub mod kitwallet;
pub mod lockup;
pub mod tta;

const POOL_SIZE: u32 = 500;
const SEMAPHORE_SIZE: usize = 50;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
info!("Starting up");
Expand Down Expand Up @@ -108,7 +111,7 @@ fn init_tracing() -> anyhow::Result<()> {

async fn router() -> anyhow::Result<Router> {
let pool = PgPoolOptions::new()
.max_connections(50)
.max_connections(POOL_SIZE)
.connect(env!("DATABASE_URL"))
.await?;

Expand All @@ -122,7 +125,7 @@ async fn router() -> anyhow::Result<Router> {
// let near_client = JsonRpcClient::connect(NEAR_MAINNET_RPC_URL);
let ft_service = FtService::new(archival_near_client);
let kitwallet = KitWallet::new();
let semaphore = Arc::new(Semaphore::new(30));
let semaphore = Arc::new(Semaphore::new(SEMAPHORE_SIZE));

let tta_service = TTA::new(sql_client.clone(), ft_service.clone(), semaphore);

Expand Down

0 comments on commit 7532e21

Please sign in to comment.