LiveRSS.Pool (liverss v0.1.0)

LiveRSS.Pool is a GenServer that pools a RSS feed periodically.

LiveRSS.Pool.start_link(name: :live_rss_blog, url: "https://blog.test/feed.rss", refresh_every: :timer.hours(2))
LiveRSS.Pool.start_link(name: :live_rss_videos, url: "https://videos.test/feed.rss", refresh_every: :timer.hours(1))
LiveRSS.Pool.start_link(name: :live_rss_photos, url: "https://photos.test/feed.rss", refresh_every: :timer.minutes(10))

%FeederEx.Feed{} = LiveRSS.get(:live_rss_blog)

Use LiveRSS.Pool.start_link/1 to start the GenServer. You can use the following options as the example:

  • name: the atom name of the process that will be used to retrieve the feed later
  • url: the URL of the RSS feed
  • refresh_every: the frequency the feed will be fetched by the GenServer

You can use LiveRSS.get/1 to retrieve the feed as a %FeederEx.Feed{} struct.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Returns a %FeederEx.Feed{}. If the feed fails to be fetched, it returns nil and logs error.

Link to this section Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get(process_name)

@spec get(atom()) ::
  %FeederEx.Feed{
    author: term(),
    entries: term(),
    id: term(),
    image: term(),
    language: term(),
    link: term(),
    subtitle: term(),
    summary: term(),
    title: term(),
    updated: term(),
    url: term()
  }
  | nil

Returns a %FeederEx.Feed{}. If the feed fails to be fetched, it returns nil and logs error.

Link to this function

start_link(opts)