Refactor Atom feed caching

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Fixes
Fix tests
Fix tests
This commit is contained in:
Thomas Citharel
2019-03-01 12:57:22 +01:00
parent 35ff742c86
commit 5713670ac9
8 changed files with 169 additions and 113 deletions

View File

@@ -3,6 +3,7 @@ defmodule Mobilizon.Application do
The Mobilizon application
"""
use Application
import Cachex.Spec
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@@ -17,7 +18,32 @@ defmodule Mobilizon.Application do
supervisor(MobilizonWeb.Endpoint, []),
# Start your own worker by calling: Mobilizon.Worker.start_link(arg1, arg2, arg3)
# worker(Mobilizon.Worker, [arg1, arg2, arg3]),
worker(Cachex, [:mobilizon, []]),
worker(
Cachex,
[
:feed,
[
limit: 2500,
expiration:
expiration(
default: :timer.minutes(60),
interval: :timer.seconds(60)
),
fallback: fallback(default: &Mobilizon.Service.Feed.create_cache/1)
]
],
id: :cache_feed
),
worker(
Cachex,
[
:json,
[
limit: 2500
]
],
id: :cache_actor
),
worker(Guardian.DB.Token.SweeperServer, []),
worker(Mobilizon.Service.Federator, [])
]