diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-05 23:01:16 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-05 23:01:16 +0100 |
commit | ddb3dfa92ec0878240211cb2b7a8e125961b1360 (patch) | |
tree | 0111ac9f589d97503046d9a81cd3af841e17501d /lib/tasks/gs_cluster.rake | |
parent | e76890d5f4634d47514a592d501d9792ae2ff7bb (diff) |
Moved to GsParemeter.get and set defaults for a couple of validations.
Diffstat (limited to 'lib/tasks/gs_cluster.rake')
-rw-r--r-- | lib/tasks/gs_cluster.rake | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tasks/gs_cluster.rake b/lib/tasks/gs_cluster.rake index 565fd83..7b49ebb 100644 --- a/lib/tasks/gs_cluster.rake +++ b/lib/tasks/gs_cluster.rake @@ -1,15 +1,15 @@ namespace :gs_cluster do desc "Sync local data to other gs cluster nodes." task :push_waiting_data_to_other_nodes => :environment do - infinity_loop_protection_counter = GsClusterSyncLogEntry.where(:homebase_ip_address => HOMEBASE_IP_ADDRESS, + infinity_loop_protection_counter = GsClusterSyncLogEntry.where(:homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'), :waiting_to_be_synced => true).count + 10 # One bite at a time. # - while GsClusterSyncLogEntry.where(:homebase_ip_address => HOMEBASE_IP_ADDRESS, + while GsClusterSyncLogEntry.where(:homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'), :waiting_to_be_synced => true).any? && infinity_loop_protection_counter > 0 - GsClusterSyncLogEntry.where(:homebase_ip_address => HOMEBASE_IP_ADDRESS, + GsClusterSyncLogEntry.where(:homebase_ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS'), :waiting_to_be_synced => true).first.populate_other_cluster_nodes infinity_loop_protection_counter -= 1 end @@ -38,7 +38,7 @@ namespace :gs_cluster do desc "Pull objects from nodes." task :pull => :environment do - local_node = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first + local_node = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first GsNode.where(:accepts_updates_from => true).each do |remote_node| if remote_node.id == local_node.id next |