m-barthelemy / vapor-queues-fluent-driver

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

SQLITE should be supported #9

Closed thuotdwz closed 4 years ago

thuotdwz commented 4 years ago

In the readme there is a note that SQLITE is not currently working however I think with a small change it can be made working, even if it is not safe because of no transactions it will be useful for unit tests.

We can change this code in SqlitePop

            return db.execute(sql: updateQuery) { (row) in }
                .map {
                    //return db.raw(SQLQueryString("COMMIT")).run().map {
                        return id
                    //}
                }

to this

            return db.execute(sql: updateQuery) { (row) in }
                .flatMap {
                    return db.raw(SQLQueryString("COMMIT")).run().map {
                        return id
                    }
                }

I checked and this works nicely for unit tests especially if you will use in process worker. Thanks!

m-barthelemy commented 4 years ago

I'll let you make a PR if you want to fix this.