feat(redis): remove support for legacy redis client versions#12057
feat(redis): remove support for legacy redis client versions#12057
Conversation
User descriptionDescription of changeremoving support for redis v3/v4 clients. Pull-Request Checklist
PR TypeEnhancement Description
Diagram Walkthroughflowchart LR
A["Legacy Redis v3/v4<br/>Callback-based API"] -->|Remove| B["Modern Redis v5+<br/>Promise-based API"]
C["Version Detection<br/>Logic"] -->|Remove| D["Simplified<br/>Codebase"]
E["Dual API Paths<br/>in Methods"] -->|Consolidate| F["Single Promise<br/>Implementation"]
|
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
PR Code Suggestions ✨Latest suggestions up to 69ffb7b
Previous suggestions✅ Suggestions up to commit 2326fe3
✅ Suggestions up to commit a404fde
|
||||||||||||||||||||||||||||||||||||||||||
commit: |
Code Review by Qodo
1. Redis v3/v4 removal undocumented
|
| import { DataSource } from "../../../src/data-source/DataSource" | ||
|
|
||
| describe("RedisQueryResultCache", () => { | ||
| describe.skip("RedisQueryResultCache", () => { |
There was a problem hiding this comment.
Is there a reason for this skip?
There was a problem hiding this comment.
This test only verifies "detectRedisVersion" which the RedisQueryResultCache doesn't have anymore.
I'm skipping before deleting to see if that's the only test that fails.
Code Review by Qodo
1. Docs missing redis v3/v4 removal
|
|
(will fix Qodo comments) |
|
maybe I should add tests too, since it's likely |
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
| * Connected redis client. | ||
| */ | ||
| protected client: any | ||
| protected client: RedisClientType | Redis | Cluster |
There was a problem hiding this comment.
Is it ok to import types?
There was a problem hiding this comment.
In #12044 I made it mandatory to use type imports if only the types are used. Needs to be checked if importing anything from redis/ioredis is okay.
| import { DataSource } from "../data-source/DataSource" | ||
| import { QueryRunner } from "../query-runner/QueryRunner" | ||
| import { TypeORMError } from "../error/TypeORMError" | ||
| import Redis, { Cluster } from "ioredis" |
There was a problem hiding this comment.
This will made redis/ioredis a mandatory dependency of typeorm which we do not want. Type imports might work, but needs to be checked if they don't cause problems in projects using typeorm but not using redis.
There was a problem hiding this comment.
I actually checked, since I'm doing something similar with mongo:
import type { ObjectId } from "mongodb";would cause type errors in projects using TypeORM.
Unless: they set skipLibCheck: true in their TSConfig file. We do this in our project because we use @tsconfig/nodeXX which sets it by default, but it's not something we should force everyone to use.
| this.client = undefined | ||
| }) | ||
| }) | ||
| await this.client.quit() |
There was a problem hiding this comment.
Proper cleanup:
| await this.client.quit() | |
| const client = this.client | |
| this.client = undefined | |
| await client.quit() |
Description of change
removing support for redis v3/v4 clients.
Pull-Request Checklist
masterbranchFixes #00000tests/**.test.ts)docs/docs/**.md)