m-barthelemy / vapor-queues-fluent-driver

A Fluent implementation for https://github.com/vapor/queues (Vapor4)
MIT License
32 stars 16 forks source link

Issue with installation. #17

Closed Steven4294 closed 3 years ago

Steven4294 commented 3 years ago

I'm trying to set up dispatch queues in my vapor/fluent app. I'm using Postgres as my database. Most of the tutorials I've seen with vapor use Postgres, which is why I elected to use that, however the official tutorial for setting up queues uses Redis (?) which seems strange. I'm struggling to set up queues with postgres + fluent. Thank you for this great package. What I've done is

try app.queues.use(.fluent())
try app.queues.startInProcessJobs(on: .default)

in my configure.swift, however when i run my code I get: [ ERROR ] Job run failed: server: relation "_jobs" does not exist (parserOpenTable) so clearly I'm missing something obvious. I'm importing a package from import QueuesFluentDriver which allows me to do the .fluent() for my queues config. Not sure if its relevant but for my database configuration I do this:

let databaseConfig = PostgresConfiguration(hostname: herokuHost,
                                               port: 5432,
                                               username: herokuUsername,
                                               password: herokuPassword,
                                               database: herokuDatabase,
                                               tlsConfiguration: TLSConfiguration.forClient(certificateVerification: .none))

    app.databases.use(.postgres(configuration: databaseConfig, connectionPoolTimeout: .seconds(240)), as: .psql) 

When i add app.migrations.add(JobModelMigrate()) to my migrations, I get the following error when I run vapor run migrate

vapor run migrate
warning: '--enable-test-discovery' option is deprecated; tests are automatically discovered on all platforms                                                                                
[4/4] Merging module App                                                                                                                                                                    
Migrate Command: Prepare                                                                                                                                                                    
Assertion failed: PostgresConnection deinitialized before being closed.: file PostgresNIO/PSQLConnection.swift, line 109   
m-barthelemy commented 3 years ago

What if you set isDefault in your DB config?

app.databases.use(.postgres(configuration: databaseConfig, connectionPoolTimeout: .seconds(240)), as: .psql, isDefault: true) 
m-barthelemy commented 3 years ago

No reply, closing.