Changeset 1579

Show
Ignore:
Timestamp:
05/12/08 16:23:35 (2 months ago)
Author:
kindlund
Message:

Housekeeping.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/trunk/lib/HoneyClient/Manager.pm

    r1576 r1579  
    769769    my @THREAD_POOL; 
    770770 
    771 # TODO: Fix this. 
    772 my $foo = async { 
    773 threads->detach(); 
    774  
    775     # Create the cloned VMs. 
    776     for (my $counter = 0; $counter < getVar(name => "num_simultaneous_clones"); $counter++) { 
    777         my $thread = threads->create(\&_worker, \%args); 
    778         if (!defined($thread)) { 
    779             $LOG->error("Unable to create worker thread! Shutting down."); 
    780             Carp::croak "Unable to create worker thread! Shutting down."; 
    781         } 
    782  
    783         # Push thread onto thread pool. 
    784         push(@THREAD_POOL, $thread); 
    785  
    786         # TODO: Fix this. 
    787         sleep(300); 
    788     } 
    789  
    790 # TODO: Fix this. 
    791 }; 
     771    # Start up workers slowly, in order to not overwhelm the host system. 
     772    my $startup_thread = async { 
     773        threads->detach(); 
     774 
     775        # Create the cloned VMs. 
     776        for (my $counter = 0; $counter < getVar(name => "num_simultaneous_clones"); $counter++) { 
     777            my $thread = threads->create(\&_worker, \%args); 
     778            if (!defined($thread)) { 
     779                $LOG->error("Unable to create worker thread! Shutting down."); 
     780                Carp::croak "Unable to create worker thread! Shutting down."; 
     781            } 
     782 
     783            # Push thread onto thread pool. 
     784            push(@THREAD_POOL, $thread); 
     785 
     786            # Sleep for a fixed amount of time, before starting up another worker. 
     787            sleep(getVar(name => "worker_startup_delay")); 
     788        } 
     789    }; 
    792790 
    793791    # Register the host system with the database, if need be.