Open russwyte opened 1 month ago
When using SCAN to get keys - the scan method never returns a 0 cursor - resulting in infinite recursion.
0
example that should work but does not:
def findKeys(pattern: String): IO[RedisError, Chunk[String]] = def loop(cursor: Long, acc: Chunk[String]): Result[Chunk[String]] = manager.redis .scan(cursor, Some(pattern)) .returning[String] .flatMap { case (nextCursor, keys) => if nextCursor == 0L then ZIO.succeed((acc ++ keys).distinct) else loop(nextCursor, acc ++ keys) } end loop loop(0L, Chunk.empty) end findKeys
When using SCAN to get keys - the scan method never returns a
0
cursor - resulting in infinite recursion.example that should work but does not: