background-tasks

Merb::Worker.

Sometimes you wish you could execute some action after request dispatch finishes and render_then_call that is Mongrel-only thing does not fit your needs. Edge Merb now has background worker for simple tasks:


def someaction
  @foo = Foo.all
  run_later do
     do_some_processing_with(@foo)
  end

  display @foo # or render
end

The block you passed to run_later is stored away and called in a background thread. You can call run_later multiple times in the same action to queue up multiple blocks

Edit Page | History | Version: