mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
refactor!: make RedisBroker require consumer name (#11001)
* refactor(RedisBroker): require consumer name * chore: spelling Co-authored-by: Noel <buechler.noel@outlook.com> --------- Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
committed by
GitHub
parent
6431cea24b
commit
2c750a4e00
@@ -1,5 +1,4 @@
|
||||
import type { Buffer } from 'node:buffer';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
|
||||
@@ -23,25 +22,22 @@ export interface RedisBrokerOptions extends BaseBrokerOptions {
|
||||
* How long to block for messages when polling
|
||||
*/
|
||||
blockTimeout?: number;
|
||||
|
||||
/**
|
||||
* Consumer group name to use for this broker
|
||||
*
|
||||
* @see {@link https://redis.io/commands/xreadgroup/}
|
||||
*/
|
||||
group: string;
|
||||
|
||||
/**
|
||||
* Max number of messages to poll at once
|
||||
*/
|
||||
maxChunk?: number;
|
||||
|
||||
/**
|
||||
* Unique consumer name.
|
||||
*
|
||||
* @see {@link https://redis.io/commands/xreadgroup/}
|
||||
*/
|
||||
name?: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,10 +45,9 @@ export interface RedisBrokerOptions extends BaseBrokerOptions {
|
||||
*/
|
||||
export const DefaultRedisBrokerOptions = {
|
||||
...DefaultBrokerOptions,
|
||||
name: randomBytes(20).toString('hex'),
|
||||
maxChunk: 10,
|
||||
blockTimeout: 5_000,
|
||||
} as const satisfies Required<Omit<RedisBrokerOptions, 'group'>>;
|
||||
} as const satisfies Required<Omit<RedisBrokerOptions, 'group' | 'name'>>;
|
||||
|
||||
/**
|
||||
* Helper class with shared Redis logic
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface RPCRedisBrokerOptions extends RedisBrokerOptions {
|
||||
export const DefaultRPCRedisBrokerOptions = {
|
||||
...DefaultRedisBrokerOptions,
|
||||
timeout: 5_000,
|
||||
} as const satisfies Required<Omit<RPCRedisBrokerOptions, 'group'>>;
|
||||
} as const satisfies Required<Omit<RPCRedisBrokerOptions, 'group' | 'name'>>;
|
||||
|
||||
/**
|
||||
* RPC broker powered by Redis
|
||||
|
||||
Reference in New Issue
Block a user