[Midnightbsd-cvs] [MidnightBSD/mports] 5d9775: magus: speed up latest packages API (#551)

Lucas Holt noreply at github.com
Tue May 19 10:31:59 EDT 2026


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/mports
  Commit: 5d977570d7bf1368ead3c077236ee0cd75f05a54
      https://github.com/MidnightBSD/mports/commit/5d977570d7bf1368ead3c077236ee0cd75f05a54
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-05-19 (Tue, 19 May 2026)

  Changed paths:
    M Tools/magus/www/data/magus/index.cgi

  Log Message:
  -----------
  magus: speed up latest packages API (#551)

## Summary
- replace /api/latest object walking with bulk SQL queries
- fetch latest blessed runs per arch before loading passing ports and
categories
- preserve the existing package JSON structure

## Testing
- perl -c Tools/magus/www/data/magus/index.cgi
- git diff --check -- Tools/magus/www/data/magus/index.cgi

## Summary by Sourcery

Optimize the latest packages API endpoint to fetch data via bulk SQL
queries while preserving the existing JSON response format.

Bug Fixes:
- Handle missing or empty flavor, license, and category fields more
robustly when building the package JSON objects, and correct package
counting to use the number of result keys.

Enhancements:
- Replace ORM-based iteration over runs and ports with direct bulk SQL
queries for latest blessed runs and their passing ports and categories
to improve performance.
- Compute repository metadata such as last update time and package count
based on the retrieved rows without changing the public API structure.

---------

Signed-off-by: Lucas Holt <luke at foolishgames.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/mports/settings/notifications


More information about the Midnightbsd-cvs mailing list