Skip to content

Commit efa1ede

Browse files
committed
Move custom package collection size limit to Constants
1 parent 1572f1f commit efa1ede

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Sources/App/Commands/Reconcile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func reconcileCustomCollection(client: Client, database: Database, fullPackageLi
167167
// Limit incoming URLs to 50 since this is input outside of our control
168168
@Dependency(\.packageListRepository) var packageListRepository
169169
let incomingURLs = try await packageListRepository.fetchCustomCollection(client: client, url: collection.url)
170-
.prefix(50)
170+
.prefix(Constants.maxCustomPackageCollectionSize)
171171

172172
try await collection.reconcile(on: database, packageURLs: incomingURLs)
173173
}

Sources/App/Core/Constants.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ enum Constants {
2828
static let packageDenyListUri = URI(string: "https://raw.githubusercontent.com/SwiftPackageIndex/PackageList/main/denylist.json")
2929
static let customCollectionsUri = URI(string: "https://raw.githubusercontent.com/SwiftPackageIndex/PackageList/main/custom-package-collections.json.json")
3030

31+
static let maxCustomPackageCollectionSize = 50
32+
3133
// NB: the underlying materialised views also have a limit, this is just an additional
3234
// limit to ensure we don't spill too many rows onto the home page
3335
static let recentPackagesLimit = 7

0 commit comments

Comments
 (0)