Unverified Commit 7a053956 authored by mvdbeek's avatar mvdbeek
Browse files

Speed up ImplicitCollectionJobs.job_list

Minor tweak, for 100 items this goes from 500ms to 80ms and I assume
this becomes more significant the more jobs there are.

No changes to the API, we should probably paginate this and just return
relevant fields, but this should address the 12s load time on the
backend when you click on a 8000+ job step.
parent c157fa2d
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2789,7 +2789,13 @@ class ImplicitCollectionJobs(Base, Serializable):

    @property
    def job_list(self):
        return [icjja.job for icjja in self.jobs]
        return (
            required_object_session(self)
            .query(Job)
            .join(ImplicitCollectionJobsJobAssociation, Job.id == ImplicitCollectionJobsJobAssociation.job_id)
            .where(ImplicitCollectionJobsJobAssociation.implicit_collection_jobs_id == self.id)
            .all()
        )

    def _serialize(self, id_encoder, serialization_options):
        rval = dict_for(