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 @@