Skip to content

Commit

Permalink
Rebuild jobs by uuid as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
bobtfish committed Feb 2, 2011
1 parent 359f51a commit 09b8dec
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/CatalystX/JobServer/TraitFor/JobRunner/JobsByUUID.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,27 @@ has jobs_by_uuid => (
is => 'ro',
traits => ['Hash', 'Serialize'],
isa => HashRef[Running],
default => sub { {} },
lazy => 1,
builder => '_build_jobs_by_uuid',
handles => {
_add_job_by_uuid => 'set',
_remove_job_by_uuid => 'delete',
},
clearer => '_clear_jobs_by_uuid',
);

before pack => sub {
shift->_clear_jobs_by_uuid;
};
method _build_jobs_by_uuid {
return {
map { $_->working_on->job->{uuid}, $_->working_on }
grep { $_->working_on->job->{uuid} }
grep { $_->working_on }
$self->workers->flatten
};
}

has _jobs_by_uuid_handles => (
is => 'ro',
isa => HashRef,
Expand Down

0 comments on commit 09b8dec

Please sign in to comment.