debasishg / scala-redis

A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side.
1.02k stars 219 forks source link

fixed bug in batched pipeline #288

Closed debasishg closed 2 years ago

debasishg commented 2 years ago

When sending commands in batch the Format related to the arguments were not being sent over. Fixed it.

debasishg commented 2 years ago

@noahlz I pushed the fix - had to switch to binary protocol for the batching. Also updated test cases. Please let me know if this works.

debasishg commented 2 years ago

@noahlz Added all the test cases from https://github.com/debasishg/scala-redis/pull/290 into PipelineSpec and all run fine. Let me know if things look good for you. I will do some cleanups and have another release.

noahlz commented 2 years ago

Ok, thanks - will test shortly. In the meantime, should we close and delete the branch for #290 ?

noahlz commented 2 years ago

I'm working through a problem where ZADD does not insert strings. I suspect because my predecessor in our application eschewed the default format and parse implicits.

I.e. we have a wrapper classes RedisPool and RedisFunctions that I suspect are Doing It Wrong (this is closed source, snippets below).

redisPool.forPipeline("test") {
  List((cmd: com.redis.RedisCommand) => RedisFunctions.ssetAdd("my key", ttl = None, "foo bar", "bazz bar")(cmd))
}

and then

scala> redisPool.withClient("test") { client => client.zrange("my key", 0, -1) }
res1: Option[List[String]] = Some(List(??bazz ba�, ??foo ba�))

scala> res2.get.foreach(println)
bazz ba�
foo ba�

In redis cli:

> zrange "mykey" 0 -1
1) "\x03\x01bazz ba\xf2"
2) "\x03\x01foo ba\xf2"

I'm working through this to figure out what's wrong. Otherwise, your changes look good. I added test case to try to reproduce the issue on my side and could not, so clearly we are Not Using Format and Parse Implicits Correctly.