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

connectionOptions.scanCount #330

Merged
merged 2 commits into from Apr 23, 2020
Merged

connectionOptions.scanCount #330

merged 2 commits into from Apr 23, 2020

Conversation

evantahler
Copy link
Member

@evantahler evantahler commented Mar 24, 2020

Allows the setting of connectionOptions.scanCount to increase the number of keys scanned by each iteration of connection.getKeys. On large datasets, this will improve the performance of queue.allDelayed(), queue.locks(), queue.stats() and even scheduler polling can get very slow, taking over 30 seconds. This is because redis.scan() gets invoked hundreds of thousands of times when connection.getKeys() gets called. connection.getKeys() uses the SCAN command in Redis. When using SCAN, the COUNT parameter is set to 10 by default.

const connectionDetails = {
  host: "127.0.0.1",
  password: null,
  port: 6379,
  database: 0
  scanCount: 1000 // <-- New!
};

const queue = new Queue({ connection: connectionDetails }, jobs);
await queue.connect();
await queue.stats()

solves #325

@evantahler evantahler merged commit 3e7d6c8 into master Apr 23, 2020
@evantahler evantahler deleted the scan-defaults branch April 23, 2020 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant