Spaces:
Sleeping
Sleeping
Scott Hiett
commited on
Commit
·
88a54bd
1
Parent(s):
2e92879
Use max_connections from connection_info config
Browse files- README.md +1 -1
- lib/srh/redis/client.ex +2 -2
README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Serverless Redis HTTP
|
2 |
A redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
|
3 |
while also not having to worry about the Redis max connection limits.
|
4 |
|
|
|
1 |
+
# SRH: Serverless Redis HTTP
|
2 |
A redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
|
3 |
while also not having to worry about the Redis max connection limits.
|
4 |
|
lib/srh/redis/client.ex
CHANGED
@@ -3,7 +3,7 @@ defmodule Srh.Redis.Client do
|
|
3 |
alias Srh.Redis.ClientRegistry
|
4 |
alias Srh.Redis.ClientWorker
|
5 |
|
6 |
-
@idle_death_time 1000 *
|
7 |
|
8 |
def start_link(max_connections, connection_info) do
|
9 |
GenServer.start_link(__MODULE__, {max_connections, connection_info}, [])
|
@@ -66,7 +66,7 @@ defmodule Srh.Redis.Client do
|
|
66 |
{:ok, pid} = ClientRegistry.start_link()
|
67 |
|
68 |
# Spin up three workers
|
69 |
-
for _ <-
|
70 |
{:ok, worker} = ClientWorker.start_link(state.connection_info)
|
71 |
ClientRegistry.add_worker(pid, worker)
|
72 |
end
|
|
|
3 |
alias Srh.Redis.ClientRegistry
|
4 |
alias Srh.Redis.ClientWorker
|
5 |
|
6 |
+
@idle_death_time 1000 * 15
|
7 |
|
8 |
def start_link(max_connections, connection_info) do
|
9 |
GenServer.start_link(__MODULE__, {max_connections, connection_info}, [])
|
|
|
66 |
{:ok, pid} = ClientRegistry.start_link()
|
67 |
|
68 |
# Spin up three workers
|
69 |
+
for _ <- 1..Map.get(state.connection_info, "max_connections", 3) do
|
70 |
{:ok, worker} = ClientWorker.start_link(state.connection_info)
|
71 |
ClientRegistry.add_worker(pid, worker)
|
72 |
end
|