From 1dffac4861e96046bbe504f50333ca3bbc05b2a7 Mon Sep 17 00:00:00 2001 From: krrrr38 Date: Tue, 30 Oct 2018 07:14:01 +0900 Subject: [PATCH] add noFailFast option to finagle-mysql --- .../io/getquill/FinagleMysqlContextConfig.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quill-finagle-mysql/src/main/scala/io/getquill/FinagleMysqlContextConfig.scala b/quill-finagle-mysql/src/main/scala/io/getquill/FinagleMysqlContextConfig.scala index b1c0774ae3..199f165794 100644 --- a/quill-finagle-mysql/src/main/scala/io/getquill/FinagleMysqlContextConfig.scala +++ b/quill-finagle-mysql/src/main/scala/io/getquill/FinagleMysqlContextConfig.scala @@ -22,9 +22,10 @@ case class FinagleMysqlContextConfig(config: Config) { def maxWaiters = Try(config.getInt("pool.maxWaiters")).getOrElse(Int.MaxValue) def maxPrepareStatements = Try(config.getInt("maxPrepareStatements")).getOrElse(20) def connectTimeout = Try(config.getInt("connectTimeout")).getOrElse(1) + def noFailFast = Try(config.getBoolean("noFailFast")).getOrElse(false) - def client = - Mysql.client + def client = { + var client = Mysql.client .withCredentials(user, password) .withDatabase(database) .withMaxConcurrentPrepareStatements(maxPrepareStatements) @@ -36,5 +37,10 @@ case class FinagleMysqlContextConfig(config: Config) { bufferSize = bufferSize, maxWaiters = maxWaiters )) - .newRichClient(dest) + if (noFailFast) { + client = client.withSessionQualifier.noFailFast + } + client.newRichClient(dest) + } + }