Changeset 1532

Show
Ignore:
Timestamp:
04/16/08 19:45:38 (4 weeks ago)
Author:
kindlund
Message:

Added Database recovery logic, in case the Ruby Drone web service connectivity is intermittent.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/etc/honeyclient.xml

    r1523 r1532  
    206206                http://172.16.164.1/hc_database/api 
    207207            </url> 
     208            <max_retry_count description="If the Manager is unable to contact the Ruby web service due to connectivity issues, then the Manager will retry up to the specified number of times before giving up." default="1800"> 
     209                1800 
     210            </max_retry_count> 
     211            <delay_between_retries description="If the Manager is unable to contact the Ruby web service due to connectivity issues, then the Manager will retry, waiting the specified amount of time (in seconds) between each retry attempt." default="2"> 
     212                2 
     213            </delay_between_retries> 
    208214        </Database> 
    209215        <!-- HoneyClient::Manager::FW Options --> 
  • honeyclient/trunk/lib/HoneyClient/Manager/Database.pm

    r1499 r1532  
    241241    my $xmlrpc = XML::RPC->new(getVar(name => "url"), %options); 
    242242    my $ret = undef; 
    243     
    244     eval { 
    245         $ret = $xmlrpc->call($name,@_); 
    246     }; 
    247  
     243 
     244    # Retry if communications fail intermittently. 
     245    my $count = 0; 
     246    while (($@ || !defined($ret)) && ($count < getVar(name => "max_retry_count"))) { 
     247        eval { 
     248            $ret = $xmlrpc->call($name,@_); 
     249        }; 
     250        if ($@ || !defined($ret)) { 
     251            $LOG->warn("Database connectivity lost.  Retrying in (" . getVar(name => "delay_between_retries") . ") seconds."); 
     252            sleep(getVar(name => "delay_between_retries")); 
     253        } 
     254        $count++; 
     255    } 
    248256    # Error checking. 
    249257    if ($@ || !defined($ret)) {