In application the app class you are calling Persistence.setUp(). But you are not passing “pool” var out of it. So in my application when I want to use SwiftKuery raw sql and access the pool for a connection there does not seem to be a way of accessing pool. You are creating pool inside a static function and assigning it to Database.default. Have no idea how to access it.
Thanks,
Garth
Solved my issue. First I added extension App to my Routes swift. Then found answer on page 195 of Kitura book. "let pool = PostgreSQLConnection.createPool(
host: ProcessInfo.processInfo.environment[“DBHOST”]
?? "localhost”
Excerpt From: David Okun. “Server Side Swift with Kitura.” Apple Books.
This grabbed the correct dbhost for inside docker image…
Garth
Nice work! Let me know if you have any questions moving forward :]
So I solved the pool issue for running with swift build and swift run (it runs for ever). If I do a kitura build and a kitura run it works for awhile and then it comes up with “No result set returned from query”. I have 5 initial connections in pool with a max connections of 10. Also tried 5 initial and 5 max. It appears that I am getting a stagnate connection when I am running in a docker container. Have been trying to find answers for a few days. Will keep you posted if I find solution.
Thanks,
Garth
@garths Do you still have issues with this?
I never made it work as a static pool. I went ahead and opened a new connection with every method call. I notice other work being shown that does use static App.pool etc. but have no idea how that works.
Garth