From f7131c827f324ffc3d3ddde7250c41a5a1a57f7e Mon Sep 17 00:00:00 2001 From: RubyOn Date: Sat, 19 Apr 2025 05:52:21 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=AC=EB=A6=BD=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/modbus/polling_service.rb | 7 ++++--- app/views/partials/modals/_add_schedule.html.erb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/services/modbus/polling_service.rb b/app/services/modbus/polling_service.rb index 79f153d..310c513 100644 --- a/app/services/modbus/polling_service.rb +++ b/app/services/modbus/polling_service.rb @@ -29,16 +29,17 @@ module Modbus begin now = Time.now current = [ now.hour, now.min ] + current_time = format("%02d:%02d", current[0], current[1]) + puts "# current time: #{current_time}.#{now.sec}" if current != last_logged - puts "시간 변경 감지됨: #{format('%02d:%02d', current[0], current[1])}" + puts "시간 변경 감지됨: #{current_time}" schedule = Schedule.find_by(hour: current[0], minute: current[1]) apply_schedule(schedule) if schedule last_logged = current end + sleep 1 rescue => e puts "[#{Time.current}] #{file} 에러: #{e.message}" - ensure - sleep 1 end end end diff --git a/app/views/partials/modals/_add_schedule.html.erb b/app/views/partials/modals/_add_schedule.html.erb index 828d52f..7e7b284 100644 --- a/app/views/partials/modals/_add_schedule.html.erb +++ b/app/views/partials/modals/_add_schedule.html.erb @@ -36,4 +36,4 @@
<%= submit_tag "추가", class: "btn bg-primary" %>
-<% end %> \ No newline at end of file +<% end %>