Skip to content

Commit

Permalink
correctly close conn
Browse files Browse the repository at this point in the history
  • Loading branch information
jdmcd committed Feb 12, 2019
1 parent a319c7a commit e943ae8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/JobsRedisDriver/JobsRedisDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ extension JobsRedisDriver: JobsPersistenceLayer {
return database.newConnection(on: eventLoop).flatMap { conn in
return conn.rpoplpush(source: key, destination: processing).and(result: conn)
}.flatMap(to: (RedisData, RedisClient).self) { redisData, conn in
guard let id = redisData.string else { throw Abort(.internalServerError) }
guard let id = redisData.string else {
conn.close()
throw Abort(.internalServerError)
}

return conn.rawGet(id).and(result: conn)
}.map { redisData, conn in
conn.close()
Expand Down

0 comments on commit e943ae8

Please sign in to comment.