diff --git a/Sources/QueuesFluentDriver/FluentQueue.swift b/Sources/QueuesFluentDriver/FluentQueue.swift index 5bf5c5b..50946f3 100644 --- a/Sources/QueuesFluentDriver/FluentQueue.swift +++ b/Sources/QueuesFluentDriver/FluentQueue.swift @@ -99,7 +99,8 @@ extension FluentQueue: Queue { .select () .column ("\(Self.model.$id.key)") .from (JobModel.schema) - .where ("\(Self.model.$state.key)", SQLBinaryOperator.equal, JobState.pending) + //.where ("\(Self.model.$state.key)", SQLBinaryOperator.equal, JobState.pending) + .where("\(Self.model.$state.key)", SQLBinaryOperator.equal, SQLBind.init(JobState.pending)) .orderBy("\(Self.model.$createdAt.path.first!)") .limit (1) @@ -110,8 +111,10 @@ extension FluentQueue: Queue { let query = db .update(JobModel.schema) - .set("\(Self.model.$state.key)", to: JobState.processing) - .set("\(Self.model.$updatedAt.path.first!)", to: Date()) + //.set("\(Self.model.$state.key)", to: JobState.processing) + .set(SQLColumn.init("\(Self.model.$state.key)"), to: SQLBind.init(JobState.processing)) + //.set("\(Self.model.$updatedAt.path.first!)", to: Date()) + .set(SQLColumn.init("\(Self.model.$updatedAt.path.first!)"), to: SQLBind.init(Date())) .where( SQLBinaryExpression(left: SQLColumn("\(Self.model.$id.key)"), op: SQLBinaryOperator.equal , right: subQueryGroup) ) diff --git a/Sources/QueuesFluentDriver/SQLDatabase+query.swift b/Sources/QueuesFluentDriver/SQLDatabase+query.swift index 095871e..4b3d348 100644 --- a/Sources/QueuesFluentDriver/SQLDatabase+query.swift +++ b/Sources/QueuesFluentDriver/SQLDatabase+query.swift @@ -9,12 +9,12 @@ struct sqlCache{ extension SQLDatabase { func query(db: SQLDatabase, sql: String, binds: [Encodable] = []) -> SQLRawBuilder { var sql = sql - if(sqlCache.cache.keys.contains(sql)) { + /*if(sqlCache.cache.keys.contains(sql)) { print("•••• Using SQL cache!") } else { sqlCache.cache[sql] = prepareSql(sql: sql, binds: binds).1 - } + }*/ var bindPos = 0 binds.forEach { bindPos += 1