            Task.async(fn -> update_petition({title, tag_ids}) end)
          end)
 
-    Enum.each(tasks, &Task.await/1)
-
+    Enum.each(tasks, fn task -> Task.await(task, 20_000) end)
     Logger.info("Updated petition cache on #{Timex.now() |> DateTime.to_iso8601()}")
   end
 

  alias Osdi.{Repo, Tagging, Tag}
  import Ecto.Query
  require Logger

  @in_last [hours: -1]

  def start_link do
    Task.start_link(&update/0)

        )
      )

    Agent.update(__MODULE__, fn state ->
      Map.put(state, title, %{total: total})
    end)
  end

