Update EventManager.cpp

develop
Josh Cooper 2022-11-09 16:49:35 -08:00 committed by GitHub
parent 92645ccb5b
commit f3ae193914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

@ -446,13 +446,11 @@ static void manageJobStartedEvent(color_ostream& out) {
multimap<Plugin*, EventHandler> copy(handlers[EventType::JOB_STARTED].begin(), handlers[EventType::JOB_STARTED].end()); multimap<Plugin*, EventHandler> copy(handlers[EventType::JOB_STARTED].begin(), handlers[EventType::JOB_STARTED].end());
for (df::job_list_link* link = df::global::world->jobs.list.next; link != nullptr; link = link->next) { for (df::job_list_link* link = df::global::world->jobs.list.next; link != nullptr; link = link->next) {
df::job* job = link->item; df::job* job = link->item;
bool send = false; if (job && Job::getWorker(job) && !startedJobs.count(job->id)) {
startedJobs.emplace(job->id);
for (auto &key_value : copy) { for (auto &key_value : copy) {
auto &handler = key_value.second; auto &handler = key_value.second;
// the jobs must have a worker to start // the jobs must have a worker to start
if (send || (job && Job::getWorker(job) && !startedJobs.count(job->id))) {
send = true;
startedJobs.emplace(job->id);
handler.eventHandler(out, job); handler.eventHandler(out, job);
} }
} }