Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Worker Pattern

The Worker Pattern

A Lightning Talk I gave at the March 7, 2013 Nashville Ruby on Rails Meetup.

Lee Jones

March 07, 2013
Tweet

More Decks by Lee Jones

Other Decks in Programming

Transcript

  1. Example Acme API Feed * item 1 * item 2

    * item 3 ... Thursday, March 7, 13
  2. I heard you requests... so i put a request inside

    your request Thursday, March 7, 13
  3. class AcmeIntegrationController def index if fragment.exists? @feed = fragment.data else

    fragment.fetch_in_background @feed = nil end ... Thursday, March 7, 13
  4. # app/views/acme_integration/index.html <% if @feed.present? -%> <%= render @feed %>

    <% else -%> <%= feed_fragment_helper %> <% end -%> Thursday, March 7, 13
  5. Example Acme API Feed * item 1 * item 2

    * item 3 ... Thursday, March 7, 13
  6. The Worker Pattern resources Ryan Smith: * slides: rails conf

    2010 * Video: talk at waza 2011 Rack Worker on Github speakerdeck.com/leejones ••• Thursday, March 7, 13