Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
90c4bed0
Commit
90c4bed0
authored
May 04, 2018
by
lain
Browse files
Don't expire idempotency cache for five minutes.
parent
fcd3eca1
Pipeline
#1615
passed with stages
in 4 minutes and 37 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
90c4bed0
...
...
@@ -288,6 +288,8 @@ def post_status(%{assigns: %{user: user}} = conn, %{"status" => _} = params) do
fallback:
fn
_
->
CommonAPI
.
post
(
user
,
params
)
end
)
Cachex
.
expire
(
:user_cache
,
"idem:
#{
idempotency_key
}
"
,
:timer
.
seconds
(
5
*
60
))
render
(
conn
,
StatusView
,
"status.json"
,
%{
activity:
activity
,
for:
user
,
as:
:activity
})
end
...
...
test/web/mastodon_api/mastodon_api_controller_test.exs
View file @
90c4bed0
...
...
@@ -75,6 +75,10 @@ test "posting a status", %{conn: conn} do
"sensitive"
=>
"false"
})
{
:ok
,
ttl
}
=
Cachex
.
ttl
(
:user_cache
,
"idem:
#{
idempotency_key
}
"
)
# 5 Minutes
assert
ttl
>
:timer
.
seconds
(
5
*
60
-
1
)
assert
%{
"content"
=>
"cofe"
,
"id"
=>
id
,
"spoiler_text"
=>
"2hu"
,
"sensitive"
=>
false
}
=
json_response
(
conn_one
,
200
)
...
...
Steph
@Steph
·
May 04, 2018
Contributor
5 minutes is pretty short. I would have gone 24h to be truly safe.
5 minutes is pretty short. I would have gone 24h to be truly safe.
Write
Preview
Supports
Markdown
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