Revisions
-
tagrudev revised this gist
Dec 21, 2012 . 2 changed files with 12 additions and 33 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,33 +0,0 @@ -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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