Skip to content

Commit bd166e8

Browse files
authored
100% CPU usage in the dashboard fix (#940)
1 parent 00f1767 commit bd166e8

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

pgml-dashboard/src/guards.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rocket::request::{self, FromRequest, Request};
66
use sqlx::{postgres::PgPoolOptions, Executor, PgPool};
77

88
use crate::models;
9-
use crate::{ClustersSettings, Context};
9+
use crate::Context;
1010

1111
pub fn default_database_url() -> String {
1212
match var("DATABASE_URL") {
@@ -25,20 +25,13 @@ impl Default for Cluster {
2525
fn default() -> Self {
2626
let max_connections = 1;
2727
let min_connections = 1;
28-
let idle_timeout = 0;
29-
30-
let settings = ClustersSettings {
31-
max_connections,
32-
idle_timeout,
33-
min_connections,
34-
};
3528

3629
Cluster {
3730
pool: Some(
3831
PgPoolOptions::new()
39-
.max_connections(settings.max_connections)
40-
.idle_timeout(std::time::Duration::from_millis(settings.idle_timeout))
41-
.min_connections(settings.min_connections)
32+
.max_connections(max_connections)
33+
.idle_timeout(None)
34+
.min_connections(min_connections)
4235
.after_connect(|conn, _meta| {
4336
Box::pin(async move {
4437
conn.execute("SET application_name = 'pgml_dashboard';")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy