diff --git a/app/controllers/air/transmitter_log_entries_controller.rb b/app/controllers/air/transmitter_log_entries_controller.rb index 90c023b..daff84c 100644 --- a/app/controllers/air/transmitter_log_entries_controller.rb +++ b/app/controllers/air/transmitter_log_entries_controller.rb @@ -8,10 +8,12 @@ def index # scrape the power readings page begin - doc = Nokogiri::XML(open('http://opdesk.wrek.org/engineering/arc16xml.php')) - @plate_current = doc.at_css('Channel[name="PLTCUR"]')[:value] - @plate_voltage = doc.at_css('Channel[name="PLTVLT"]')[:value] - @power_out = doc.at_css('Channel[name="PWROUT"]')[:value] + timout(5) do + doc = Nokogiri::XML(open('http://opdesk.wrek.org/engineering/arc16xml.php')) + @plate_current = doc.at_css('Channel[name="PLTCUR"]')[:value] + @plate_voltage = doc.at_css('Channel[name="PLTVLT"]')[:value] + @power_out = doc.at_css('Channel[name="PWROUT"]')[:value] + end rescue @plate_current = "?" @plate_voltage = "?" @@ -63,4 +65,4 @@ def transmitter_log_entry_params params.require(:transmitter_log_entry).permit(:sign_in, :automation_in, :automation_out, :sign_out) end -end \ No newline at end of file +end