scala - Forcing Redis to Timeout -



scala - Forcing Redis to Timeout -

i trying forcefulness redis client timeout testing purpose , fail accomplish so. specify timeout 2ms in config , set operation perform takes > 2ms why not timeout? these settings kind of soft settings , not hard enforcement? using jedis 2.6 , scala 2.10 play 2.2.3

@singleton class redisclient extends cache { // set timeout val timeout = 2 private val pool = new jedispool(new jedispoolconfig(), getstringfromconfig("redis.url"), getintfromconfig("redis.port"), timeout); def isopen = pool.getnumactive() def set(key: string, value: string) = { isopen match { case -1 => throw new exception("redis server not running") case _ => { val jedis = pool.getresource() val before = platform.currenttime jedis.set(key, value) println("time taken " + (platform.currenttime - before)) pool.returnresource(jedis) } } } }

actualy not need test may found reply in jedis sources. timeout value used:

as java socket connection timeout as so_timeout value. more info here.

to accomplish goal in test:

redis server should heavy loaded during test not take connection. if need connection timeout. try utilize proxy drop downwards connection perfomance (timeout so_timeout value).

scala playframework redis jedis

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -