Skip to content

Commit

Permalink
Merge pull request #2563 from SwiftPackageIndex/issue-2227-eventloop-…
Browse files Browse the repository at this point in the history
…changes

Attempt to fix #2227
  • Loading branch information
finestructure authored Aug 20, 2023
2 parents 532033e + b00334a commit 3a3731b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Sources/App/Commands/Analyze.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ enum Analyze {
let limit = signature.limit ?? defaultLimit

let client = context.application.client
let db = context.application.db
let eventLoop = context.application.eventLoopGroup.any()
let db = context.application._db(.psql, on: eventLoop)
let logger = Logger(component: "analyze")
Current.setLogger(logger)

Expand Down Expand Up @@ -737,3 +738,18 @@ extension Analyze {


extension App.FileManager: DependencyResolution.FileManager { }


// WIP attempted fix for issue 2227 https://github.com/vapor/async-kit/issues/104#issuecomment-1685273685
private extension Application {
func _db(_ id: DatabaseID?, on eventLoop: any EventLoop) -> any Database {
self.databases
.database(
id,
logger: self.logger,
on: eventLoop,
history: nil,
pageSizeLimit: self.fluent.pagination.pageSizeLimit
)!
}
}

0 comments on commit 3a3731b

Please sign in to comment.