Skip to content

Commit

Permalink
only serve top 1000 packages for collection
Browse files Browse the repository at this point in the history
  • Loading branch information
twodayslate committed Oct 26, 2021
1 parent 26a7e49 commit 2f78ff4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/api/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function (router) {
})
}

router.get('/collection.json', router.apicache("6 hours"), async function (req, res) {
router.get('/collection.json', router.apicache("12 hours"), async function (req, res) {
const packages = await router.db.Package.findAll({
where: {
processing: false,
Expand All @@ -56,16 +56,18 @@ module.exports = function (router) {
"description.tools_version": {
[router.db.Sequelize.Op.not]: null
},
}
},
order: [["info.stargazers_count", "DESC"]],
limit: 1000
})

req.robot.log("packages:")
req.robot.log(packages)
// format https://github.com/apple/swift-package-manager/blob/main/Sources/PackageCollectionsModel/Formats/v1.md
const ans = JSON.stringify({
"overview": "A collection of all the Swift packages on the Swift Package Registry",
"overview": "A collection of the top 1000 Swift packages on the Swift Package Registry",
"formatVersion": "1.0",
"name": "Packages from the Swift Package Registry",
"name": "Top 1000 Packages from the Swift Package Registry",
"generatedBy": {"name": "The Swift Package Registry"},
"keywords": ["swift package registry"],
"packages": map_packages(packages),
Expand Down

0 comments on commit 2f78ff4

Please sign in to comment.