Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plausible-analytics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
varac-projects
plausible-analytics
Commits
f77c3780
Commit
f77c3780
authored
3 years ago
by
Uku Taht
Browse files
Options
Downloads
Patches
Plain Diff
Use safe version of Cachex.fetch
Fixes #905
parent
85fcdbdb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/plausible_web/controllers/api/external_controller.ex
+10
-3
10 additions, 3 deletions
lib/plausible_web/controllers/api/external_controller.ex
mix.exs
+1
-1
1 addition, 1 deletion
mix.exs
mix.lock
+1
-1
1 addition, 1 deletion
mix.lock
with
12 additions
and
5 deletions
lib/plausible_web/controllers/api/external_controller.ex
+
10
−
3
View file @
f77c3780
...
...
@@ -50,9 +50,16 @@ defmodule PlausibleWeb.Api.ExternalController do
user_agent
=
Plug
.
Conn
.
get_req_header
(
conn
,
"user-agent"
)
|>
List
.
first
()
if
user_agent
do
Cachex
.
fetch!
(
:user_agents
,
user_agent
,
fn
ua
->
{
:commit
,
UAInspector
.
parse
(
ua
)}
res
=
Cachex
.
fetch
(
:user_agents
,
user_agent
,
fn
ua
->
UAInspector
.
parse
(
ua
)
end
)
case
res
do
{
:ok
,
user_agent
}
->
user_agent
{
:commit
,
user_agent
}
->
user_agent
_
->
nil
end
end
end
...
...
This diff is collapsed.
Click to expand it.
mix.exs
+
1
−
1
View file @
f77c3780
...
...
@@ -90,7 +90,7 @@ defmodule Plausible.MixProject do
{
:clickhouse_ecto
,
git:
"https://github.com/plausible/clickhouse_ecto.git"
},
{
:geolix_adapter_mmdb2
,
"~> 0.5.0"
},
{
:mix_test_watch
,
"~> 1.0"
,
only:
:dev
,
runtime:
false
},
{
:cachex
,
"~> 3.
3
"
},
{
:cachex
,
"~> 3.
4
"
},
{
:dialyxir
,
"~> 1.0"
,
only:
[
:dev
,
:test
],
runtime:
false
},
{
:credo
,
"~> 1.5"
,
only:
[
:dev
,
:test
],
runtime:
false
},
{
:kaffy
,
"~> 0.9.0"
},
...
...
This diff is collapsed.
Click to expand it.
mix.lock
+
1
−
1
View file @
f77c3780
...
...
@@ -10,7 +10,7 @@
"bertex": {:hex, :bertex, "1.3.0", "0ad0df9159b5110d9d2b6654f72fbf42a54884ef43b6b651e6224c0af30ba3cb", [:mix], [], "hexpm", "0a5d5e478bb5764b7b7bae37cae1ca491200e58b089df121a2fe1c223d8ee57a"},
"browser": {:hex, :browser, "0.4.4", "bd6436961a6b2299c6cb38d0e49761c1161d869cd0db46369cef2bf6b77c3665", [:mix], [{:plug, "~> 1.2", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "d476ca309d4a4b19742b870380390aabbcb323c1f6f8745e2da2dfd079b4f8d7"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"cachex": {:hex, :cachex, "3.
3
.0", "
6f2ebb8f27491fe39121bd207c78badc499214d76c695658b19d6079beeca5c2
", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", optional: false]}, {:sleeplocks, "~> 1.1", [hex: :sleeplocks, repo: "hexpm", optional: false]}, {:unsafe, "~> 1.0", [hex: :unsafe, repo: "hexpm", optional: false]}], "hexpm", "
d90e5ee1dde14cef33f6b187af4335b88748b72b30c038969176cd4e6ccc31a1
"},
"cachex": {:hex, :cachex, "3.
4
.0", "
868b2959ea4aeb328c6b60ff66c8d5123c083466ad3c33d3d8b5f142e13101fb
", [:mix], [{:eternal, "~> 1.2", [hex: :eternal, repo: "hexpm", optional: false]}, {:jumper, "~> 1.0", [hex: :jumper, repo: "hexpm", optional: false]}, {:sleeplocks, "~> 1.1", [hex: :sleeplocks, repo: "hexpm", optional: false]}, {:unsafe, "~> 1.0", [hex: :unsafe, repo: "hexpm", optional: false]}], "hexpm", "
370123b1ab4fba4d2965fb18f87fd758325709787c8c5fce35b3fe80645ccbe5
"},
"certifi": {:hex, :certifi, "2.6.1", "dbab8e5e155a0763eea978c913ca280a6b544bfa115633fa20249c3d396d9493", [:rebar3], [], "hexpm", "524c97b4991b3849dd5c17a631223896272c6b0af446778ba4675a1dff53bb7e"},
"clickhouse_ecto": {:git, "https://github.com/plausible/clickhouse_ecto.git", "93d86c48230f85797555c348dbe9e8738d3b8cc2", []},
"clickhousex": {:git, "https://github.com/plausible/clickhousex", "0832dd4b1af1f0eba1d1018c231bf0d8d281f031", []},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment