lib/rhoconnect/handler/query/engine.rb in rhoconnect-4.0.3 vs lib/rhoconnect/handler/query/engine.rb in rhoconnect-4.0.4

- old
+ new

@@ -24,25 +24,31 @@ def do_sync query_res = nil if source.query_queue or source.queue query_res = async(:query, source.query_queue || source.queue, params[:query]) else - source.if_need_refresh do - Rhoconnect::Stats::Record.update("source:query:#{source.name}") do - if auth_method('login') - query_res = run_query - auth_method('logoff') - end - # re-wind refresh time in case of error - query_failure = source.exists?(:errors) - source.rewind_refresh_time(query_failure) + query_res = run_query + end + query_res + end + + def run_query + query_res = nil + source.if_need_refresh do + Rhoconnect::Stats::Record.update("source:query:#{source.name}") do + if auth_method('login') + query_res = _execute_query + auth_method('logoff') end + # re-wind refresh time in case of error + query_failure = source.exists?(:errors) + source.rewind_refresh_time(query_failure) end end query_res end - def run_query + def _execute_query errordoc = nil docobj = nil result = nil begin errordoc = :errors \ No newline at end of file