Commit 0067c9d2 authored by lain's avatar lain
Browse files

Only push to still valid websub subscriptions.

parent 71cee076
Pipeline #917 passed with stage
in 2 minutes and 29 seconds
......@@ -49,7 +49,8 @@ def verify(subscription, getter \\ &@httpoison.get/3) do
def publish(topic, user, %{data: %{"type" => type}} = activity) when type in @supported_activities do
# TODO: Only send to still valid subscriptions.
query = from sub in WebsubServerSubscription,
where: sub.topic == ^topic and sub.state == "active"
where: sub.topic == ^topic and sub.state == "active",
where: fragment("? > NOW()", sub.valid_until)
subscriptions = Repo.all(query)
Enum.each(subscriptions, fn(sub) ->
response = user
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment