Changeset 2315
- Timestamp:
- 05/13/08 17:43:51 (21 months ago)
- Files:
-
- 1 modified
-
branches/release-38/lib/MT/TheSchwartz.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-38/lib/MT/TheSchwartz.pm
r2272 r2315 86 86 TheSchwartz::Error->properties->{datasource} = 'ts_error'; 87 87 TheSchwartz::ExitStatus->properties->{datasource} = 'ts_exitstatus'; 88 89 my $job_set_exit_status = \&TheSchwartz::Job::set_exit_status;90 my $job_add_failure = \&TheSchwartz::Job::add_failure;91 92 my $driver = MT::Object->driver;93 no warnings 'redefine';94 *TheSchwartz::Job::set_exit_status = sub {95 $driver->Disabled(1);96 my $res = $job_set_exit_status->(@_);97 $driver->Disabled(0);98 return $res;99 };100 *TheSchwartz::Job::add_failure = sub {101 $driver->Disabled(1);102 my $res = $job_add_failure->(@_);103 $driver->Disabled(0);104 return $res;105 };106 107 88 return $initialized = 1; 108 89 } … … 110 91 sub driver_for { 111 92 my MT::TheSchwartz $client = shift; 112 return MT::Object->d river;93 return MT::Object->dbi_driver; 113 94 } 114 95 … … 147 128 $delay ||= 5; 148 129 my $last_task_run = 0; 130 my $did_work = 0; 149 131 while (1) { 150 unless ($client->work_once) { 151 my $driver = $client->driver_for(); 152 $driver->clear_cache 153 if $driver->can('clear_cache'); 154 MT->request->reset(); 155 sleep $delay; 132 if ($client->work_once) { 133 $did_work = 1; 134 } else { 135 if ($did_work) { 136 my $driver = MT::Object->driver; 137 $driver->clear_cache 138 if $driver->can('clear_cache'); 139 MT->request->reset(); 140 $did_work = 0; 141 } 156 142 157 143 if ($last_task_run + 60 * 5 < time) { … … 160 146 } 161 147 } 148 sleep $delay; 162 149 } 163 150 }
