Skip to content

Commit

Permalink
fix: Update ioredis types & align adapter types, closes #271, #272 (#273
Browse files Browse the repository at this point in the history
)
  • Loading branch information
felixmosh committed Jun 28, 2021
1 parent fcc2c17 commit 889de33
Show file tree
Hide file tree
Showing 6 changed files with 441 additions and 2,090 deletions.
43 changes: 21 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,54 +44,54 @@
"dependencies": {
"@types/express": "^4.17.9",
"@types/express-serve-static-core": "^4.17.14",
"@types/ioredis": "^4.22.3",
"ejs": "3.1.6",
"express": "4.17.1",
"redis-info": "^3.0.8"
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/core": "^7.14.0",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-env": "^7.14.1",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.13.10",
"@babel/runtime": "^7.14.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
"@types/bull": "^3.14.4",
"@types/bull": "^3.15.1",
"@types/classnames": "^2.2.11",
"@types/jest": "^26.0.21",
"@types/ioredis": "^4.26.1",
"@types/jest": "^26.0.23",
"@types/node": "^14.14.35",
"@types/pretty-bytes": "^5.2.0",
"@types/react-dom": "^17.0.2",
"@types/react-highlight": "^0.12.2",
"@types/react-router-dom": "^5.1.6",
"@types/redis-info": "^3.0.0",
"@types/supertest": "^2.0.10",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@typescript-eslint/typescript-estree": "^4.18.0",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"@typescript-eslint/typescript-estree": "^4.22.1",
"auto-changelog": "^2.2.1",
"axios": "^0.21.1",
"babel-loader": "^8.2.2",
"bull": "^3.21.1",
"bullmq": "^1.21.0",
"bull": "^3.22.4",
"bullmq": "^1.24.5",
"clsx": "^1.1.1",
"css-loader": "^5.1.3",
"css-minimizer-webpack-plugin": "^2.0.0",
"date-fns": "2.21.1",
"date-fns": "2.21.3",
"dockest": "2.1.0",
"eslint": "^7.24.0",
"eslint-config-prettier": "^8.2.0",
"eslint-plugin-no-only-tests": "^2.4.0",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.21.5",
"fork-ts-checker-webpack-plugin": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.2.6",
"highlight.js": "^10.7.1",
"html-webpack-plugin": "^5.3.1",
"jest": "^26.6.3",
"mini-css-extract-plugin": "^1.3.9",
"mini-css-extract-plugin": "^1.6.0",
"postcss-loader": "^5.2.0",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.2.1",
Expand All @@ -102,16 +102,15 @@
"react-dom": "17.0.2",
"react-refresh": "^0.10.0",
"react-router-dom": "^5.2.0",
"react-toastify": "^7.0.3",
"react-toastify": "^7.0.4",
"release-it": "^14.5.0",
"snyk": "^1.503.0",
"style-loader": "^2.0.0",
"supertest": "^6.0.1",
"ts-jest": "^26.5.4",
"ts-jest": "^26.5.6",
"ts-node-dev": "^1.1.6",
"typescript": "^4.2.3",
"webpack": "^5.35.0",
"webpack-cli": "^4.5.0",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.0"
},
"release-it": {
Expand Down
3 changes: 1 addition & 2 deletions src/queueAdapters/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as Redis from 'ioredis'
import {
JobCleanStatus,
JobCounts,
Expand Down Expand Up @@ -48,5 +47,5 @@ export abstract class BaseAdapter {

public abstract getName(): string

public abstract getClient(): Promise<Redis.Redis>
public abstract getRedisInfo(): Promise<string>
}
4 changes: 2 additions & 2 deletions src/queueAdapters/bull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export class BullAdapter extends BaseAdapter {
super(options)
}

public getClient(): Promise<Queue['client']> {
return Promise.resolve(this.queue.client)
public getRedisInfo(): Promise<string> {
return this.queue.client.info()
}

public getName(): string {
Expand Down
5 changes: 3 additions & 2 deletions src/queueAdapters/bullMQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export class BullMQAdapter extends BaseAdapter {
super(options)
}

public getClient(): Queue['client'] {
return this.queue.client
public async getRedisInfo(): Promise<string> {
const client = await this.queue.client
return client.info()
}

public getName(): string {
Expand Down
3 changes: 1 addition & 2 deletions src/routes/handlers/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ const metrics: MetricName[] = [
]

const getStats = async (queue: BaseAdapter): Promise<app.ValidMetrics> => {
const redisClient = await queue.getClient()
const redisInfoRaw = await redisClient.info()
const redisInfoRaw = await queue.getRedisInfo()
const redisInfo = parseRedisInfo(redisInfoRaw)

const validMetrics = metrics.reduce((acc, metric) => {
Expand Down
Loading

0 comments on commit 889de33

Please sign in to comment.