diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-05 23:10:07 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-05 23:10:07 +0100 |
commit | 3862734b5e0833ed108300102c68159e40ffd93a (patch) | |
tree | 4491044dbf48aea515303382e7664cf9be2cb182 /lib/tasks/gs_cluster.rake | |
parent | 380a4cdfe5cfa573fb916ca7c2145a6062ef8198 (diff) | |
parent | 57196d838691aeba38ad7e088e83c0881a213861 (diff) |
Merge branch 'replace_constants' into develop
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 |