aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/src/database.rs
diff options
context:
space:
mode:
authorTeddy Wing2018-11-11 01:50:03 +0100
committerTeddy Wing2018-11-11 01:50:03 +0100
commitb233d678f2109fecc7c6a4b9e2d65590819d96d1 (patch)
treefb892fe7ec27af9da2a6198c65496fb9a3d04c0e /license-generator/src/database.rs
parentf21e06fa26880166ec4df467ee4723503dfbad55 (diff)
downloaddome-key-web-b233d678f2109fecc7c6a4b9e2d65590819d96d1.tar.bz2
main(): Get a database connection pool instead of a single connection
This way we can ask the pool for a connection on each request instead of trying to reuse a single connection.
Diffstat (limited to 'license-generator/src/database.rs')
-rw-r--r--license-generator/src/database.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/license-generator/src/database.rs b/license-generator/src/database.rs
index 505a788..a0331c2 100644
--- a/license-generator/src/database.rs
+++ b/license-generator/src/database.rs
@@ -4,11 +4,10 @@ use mysql;
use errors::*;
-pub fn get_database_connection() -> Result<mysql::PooledConn> {
+pub fn get_database_pool() -> Result<mysql::Pool> {
let connection_url = env::var("DATABASE_URL")
.chain_err(|| "DATABASE_URL environment variable not found")?;
let pool = mysql::Pool::new_manual(10, 50, connection_url)?;
- let cx = pool.get_conn()?;
- Ok(cx)
+ Ok(pool)
}