mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 18:46:07 +00:00
feat: add package pruning system with configurable grace periods
- Implemented automatic pruning of stale packages across all platform sync endpoints (Arch, AUR, Debian, Ubuntu, Fedora, Homebrew, Winget) - Added `last_seen_at` tracking to mark packages as seen during sync runs and identify inactive packages - Introduced `PRUNE_GRACE_DAYS` and `PRUNE_HARD_DELETE_DAYS` environment variables for configurable soft-delete and hard-delete thresholds
This commit is contained in:
@@ -210,8 +210,8 @@ export class PackageService {
|
||||
`INSERT INTO packages (
|
||||
id, name, description, version, platform_id, category_id,
|
||||
license_id, type, repository, homepage_url, download_url,
|
||||
popularity_score
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
|
||||
popularity_score, last_seen_at
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, NOW())
|
||||
RETURNING *`,
|
||||
[id, name, description, version, platform_id, category_id,
|
||||
license_id, type, repository, homepage_url, download_url,
|
||||
@@ -238,6 +238,11 @@ export class PackageService {
|
||||
}
|
||||
}
|
||||
|
||||
// Always mark as seen and active on update
|
||||
fields.push('last_seen_at = NOW()')
|
||||
fields.push('is_active = true')
|
||||
fields.push('updated_at = NOW()')
|
||||
|
||||
if (fields.length === 0) {
|
||||
return this.getById(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user