CERT-Polska / mquery

YARA malware query accelerator (web frontend)
GNU Affero General Public License v3.0
413 stars 77 forks source link

Refactor database handling in /api/job endpoint #394

Closed msm-cert closed 1 month ago

msm-cert commented 1 month ago

After the PR #371 some endpoints are really dumb, including /api/job

    jobs = [db.get_job(job) for job in db.get_job_ids()]

This is a classic N+1 query problem. A better solution would be to combine get_job_ids and get_job into just get_jobs in the db.py. Then get_job_ids can be removed, since it's only used in this place.