Skip to content

Instantly share code, notes, and snippets.

@tagrudev
Forked from anonymous/gist:4351607
Last active December 10, 2015 00:29

Revisions

  1. tagrudev revised this gist Dec 21, 2012. 2 changed files with 12 additions and 33 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    def create_report
    if @inspection.type == 'RoutineInspection'
    puts "---CR> CREATING ROUTINE INSPECTION REPORT"
    pdf = routine_inspection_generic
    else
    puts "---CR> CREATING INGOING INSPECTION REPORT"
    thread = Thread.new do
    pdf = ingoing_inspection_nsw
    end.join
    end
    pdf
    end
    33 changes: 0 additions & 33 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,33 +0,0 @@
    def retryable(options = {})
    opts = { :tries => 1, :on => Exception }.merge(options)

    retry_exception, retries = opts[:on], opts[:tries]

    begin
    return yield
    rescue retry_exception
    if (retries -= 1) > 0
    sleep 2
    retry
    else
    raise
    end
    end
    end

    def create_report
    if @inspection.type == 'RoutineInspection'
    puts "---CR> CREATING ROUTINE INSPECTION REPORT"
    pdf = routine_inspection_generic
    else
    puts "---CR> CREATING INGOING INSPECTION REPORT"

    thread = Thread.new do
    pdf = ingoing_inspection_nsw
    end
    retryable(:tries => 10, :on => ActionView::Template::Error) do
    thread.join
    end
    end
    pdf
    end
  2. @invalid-email-address Anonymous created this gist Dec 21, 2012.
    33 changes: 33 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    def retryable(options = {})
    opts = { :tries => 1, :on => Exception }.merge(options)

    retry_exception, retries = opts[:on], opts[:tries]

    begin
    return yield
    rescue retry_exception
    if (retries -= 1) > 0
    sleep 2
    retry
    else
    raise
    end
    end
    end

    def create_report
    if @inspection.type == 'RoutineInspection'
    puts "---CR> CREATING ROUTINE INSPECTION REPORT"
    pdf = routine_inspection_generic
    else
    puts "---CR> CREATING INGOING INSPECTION REPORT"

    thread = Thread.new do
    pdf = ingoing_inspection_nsw
    end
    retryable(:tries => 10, :on => ActionView::Template::Error) do
    thread.join
    end
    end
    pdf
    end