Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(queue): use QueueOptions type in opts attribute #2481

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/classes/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class Queue<
> extends QueueGetters<DataType, ResultType, NameType> {
token = v4();
jobsOpts: BaseJobOptions;
opts: QueueOptions;
private _repeat?: Repeat;

constructor(
Expand All @@ -116,11 +117,7 @@ export class Queue<
this.waitUntilReady()
.then(client => {
if (!this.closing) {
client.hset(
this.keys.meta,
'opts.maxLenEvents',
opts?.streams?.events?.maxLen ?? 10000,
);
client.hmset(this.keys.meta, this.metaValues);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using hmset to be reused in pro version

}
})
.catch(err => {
Expand Down Expand Up @@ -167,6 +164,12 @@ export class Queue<
return { ...this.jobsOpts };
}

get metaValues(): Record<string, string | number> {
return {
'opts.maxLenEvents': this.opts?.streams?.events?.maxLen ?? 10000,
};
}

get repeat(): Promise<Repeat> {
return new Promise<Repeat>(async resolve => {
if (!this._repeat) {
Expand Down
Loading