Skip to content

Commit 76486d3

Browse files
committed
Code cleaning
1 parent ef22da3 commit 76486d3

File tree

8 files changed

+11
-14
lines changed

8 files changed

+11
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
A Redis connection pooler for serverless applications. This allows your serverless functions to talk to Redis via HTTP,
33
while also not having to worry about the Redis max connection limits.
44

5-
The idea is you host this alongside your Redis server, so minimise latency. The serverless functions can then talk to
5+
The idea is you host this alongside your Redis server, to minimise latency. Your serverless functions can then talk to
66
this via HTTP.
77

88
## Features

config/config.exs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Config
22

33
config :srh,
44
mode: "file",
5-
file_path: "srh-config/tokens.json",
6-
file_hard_reload: false
5+
file_path: "srh-config/tokens.json"
76

87
import_config "#{config_env()}.exs"

config/dev.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
11
import Config
2-
3-
config :srh,
4-
file_hard_reload: true

lib/srh/auth/token_resolver.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ defmodule Srh.Auth.TokenResolver do
33

44
@mode Application.fetch_env!(:srh, :mode)
55
@file_path Application.fetch_env!(:srh, :file_path)
6-
@file_hard_reload Application.fetch_env!(:srh, :file_hard_reload)
76

87
@ets_table_name :srh_token_resolver
98

@@ -74,7 +73,7 @@ defmodule Srh.Auth.TokenResolver do
7473
end
7574
end
7675

77-
defp do_resolve("redis", token) do
76+
defp do_resolve("redis", _token) do
7877
{
7978
:ok,
8079
# This is done to replicate what will eventually be API endpoints, so they keys are not atoms

lib/srh/http/base_router.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ defmodule Srh.Http.BaseRouter do
4949
{:malformed_data, message} -> %{code: 400, message: message, json: false}
5050
{:not_authorized, message} -> %{code: 401, message: message, json: false}
5151
{:server_error, _} -> %{code: 500, message: "An error occurred internally", json: false}
52-
other ->
52+
_ ->
5353
%{code: 500, message: "An error occurred internally", json: false}
5454
end
5555

lib/srh/http/command_handler.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ defmodule Srh.Http.CommandHandler do
3838
end
3939
end
4040

41-
defp dispatch_command_array([current | rest], connection_info, responses \\ []) do
41+
defp dispatch_command_array(_arr, _connection_info, responses \\ [])
42+
43+
defp dispatch_command_array([current | rest], connection_info, responses) do
4244
updated_responses = case dispatch_command(current, connection_info) do
4345
{:ok, result_map} ->
4446
[result_map | responses]
@@ -50,7 +52,7 @@ defmodule Srh.Http.CommandHandler do
5052
dispatch_command_array(rest, connection_info, updated_responses)
5153
end
5254

53-
defp dispatch_command_array([], connection_info, responses) do
55+
defp dispatch_command_array([], _connection_info, responses) do
5456
# The responses will be in reverse order, as we're adding them to the list with the faster method of putting them at head.
5557
{:ok, Enum.reverse(responses)}
5658
end

lib/srh/http/request_validator.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Srh.Http.RequestValidator do
22
def validate_redis_body(%{"_json" => command_array}) when is_list(command_array), do: {:ok, command_array}
33

4-
def validate_redis_body(payload),
4+
def validate_redis_body(_),
55
do: {:error, "Invalid command array. Expected a string array at root of the command and its arguments."}
66

77
def validate_pipeline_redis_body(%{"_json" => array_of_command_arrays}) when is_list(array_of_command_arrays) do
@@ -20,7 +20,7 @@ defmodule Srh.Http.RequestValidator do
2020

2121
defp do_validate_pipeline_item(item) when is_list(item), do: :ok
2222

23-
defp do_validate_pipeline_item(item), do: :error
23+
defp do_validate_pipeline_item(_), do: :error
2424

2525
def validate_bearer_header(header_value_array) when is_list(header_value_array) do
2626
do_validate_bearer_header(header_value_array)

lib/srh/redis/client_worker.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule Srh.Redis.ClientWorker do
3232
end
3333
end
3434

35-
def handle_call(msg, _from, state) do
35+
def handle_call(_msg, _from, state) do
3636
{:reply, :ok, state}
3737
end
3838

0 commit comments

Comments
 (0)