lib/rubyrep/replication_run.rb in rubyrep-1.0.2 vs lib/rubyrep/replication_run.rb in rubyrep-1.0.3

- old
+ new

@@ -1,5 +1,7 @@ +require 'timeout' + module RR # Executes a single replication run class ReplicationRun @@ -18,12 +20,14 @@ end # Executes the replication run. def run return unless [:left, :right].any? do |database| - session.send(database).select_one( - "select id from #{session.configuration.options[:rep_prefix]}_pending_changes" - ) != nil + Timeout::timeout(session.configuration.options[:database_connection_timeout]) do + session.send(database).select_one( + "select id from #{session.configuration.options[:rep_prefix]}_pending_changes" + ) != nil + end end begin success = false replicator # ensure that replicator is created and has chance to validate settings \ No newline at end of file