Changeset 1870 for branches/release-34/tools/run-periodic-tasks
- Timestamp:
- 04/13/08 04:23:51 (19 months ago)
- Files:
-
- 1 modified
-
branches/release-34/tools/run-periodic-tasks (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-34/tools/run-periodic-tasks
r1407 r1870 26 26 my $sleep = 5; 27 27 my $help = 0; 28 # my $sync = 0;29 # my $rsync_opt = '';30 28 my $load = 10; 31 29 my $verbose = 0; … … 35 33 "daemon" => \$daemonize, 36 34 "sleep=i" => \$sleep, 37 # "help|?" => \$help,38 # "throttle=i" => \%throttle,39 # "worker=s" => \$worker,40 # "sync" => \$sync,41 # "to|target=s" => \@target,42 # "rsync=s" => \$rsync_opt,43 35 "load=i" => \$load, 44 36 "scoreboard=s"=> \$scoreboard, … … 51 43 $cfg{prioritize} = 1; 52 44 53 require MT::TheSchwartz; 54 my $client = MT::TheSchwartz->new(%cfg); 55 no warnings 'once'; 56 $TheSchwartz::FIND_JOB_BATCH_SIZE = $load; 45 my $client = eval { 46 require MT::TheSchwartz; 47 my $c = MT::TheSchwartz->new(%cfg); 48 no warnings 'once'; 49 $TheSchwartz::FIND_JOB_BATCH_SIZE = $load; 50 $c; 51 }; 52 if ((my $error = $@) && $verbose) { 53 print STDERR "Error initializing TheSchwartz: $error\n"; 54 } 57 55 58 if ($daemonize ) {56 if ($daemonize && $client) { 59 57 $client->work_periodically($sleep); 60 58 } else { 61 59 # First, run periodic tasks 62 60 $mt->run_tasks(); 63 $client->work_until_done ;61 $client->work_until_done if $client; 64 62 } 65 63
