Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
SpaceAPI Server
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Infrastruttura
SpaceAPI Server
Commits
ba9f6cc1
Commit
ba9f6cc1
authored
Jul 17, 2019
by
Aljaž Srebrnič
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some options to r2d2 pool
parent
6cc75a88
Pipeline
#556
passed with stages
in 8 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
src/main.rs
src/main.rs
+7
-0
No files found.
src/main.rs
View file @
ba9f6cc1
...
@@ -46,7 +46,14 @@ fn main() {
...
@@ -46,7 +46,14 @@ fn main() {
let
redis_connstring
=
var
(
"REDIS_CONNSTRING"
)
.unwrap_or_else
(|
_
|
String
::
from
(
"redis://localhost"
));
let
redis_connstring
=
var
(
"REDIS_CONNSTRING"
)
.unwrap_or_else
(|
_
|
String
::
from
(
"redis://localhost"
));
let
manager
=
r2d2_redis
::
RedisConnectionManager
::
new
(
&*
redis_connstring
)
.unwrap
();
let
manager
=
r2d2_redis
::
RedisConnectionManager
::
new
(
&*
redis_connstring
)
.unwrap
();
let
pool
=
r2d2
::
Pool
::
builder
()
let
pool
=
r2d2
::
Pool
::
builder
()
// At least 1 connection must be active
.min_idle
(
Some
(
2
))
// Try to get a connection for max 1 second
.connection_timeout
(
Duration
::
from_secs
(
1
))
.connection_timeout
(
Duration
::
from_secs
(
1
))
// Don't log errors directly.
// They can get quite verbose, and we're already catching and
// logging the corresponding results anyways.
.error_handler
(
Box
::
new
(
r2d2
::
NopErrorHandler
))
.build
(
manager
)
.build
(
manager
)
.unwrap
();
.unwrap
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment