Skip to content

Instantly share code, notes, and snippets.

@danstreeter
Forked from alexander-schranz/scan-redis.js
Last active August 23, 2022 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danstreeter/afc1faf45fcb6dd284265d941916eb0c to your computer and use it in GitHub Desktop.
Save danstreeter/afc1faf45fcb6dd284265d941916eb0c to your computer and use it in GitHub Desktop.
Scan all keys in redis insight
/*
* Run the following script in browser dev tools when having redis insight open
* to continue searching for the keypattern until the scan is completed
*
* Changelog
* 2022-08-23 - danstreeter - Update to make work in RedisInsightv2 `2.6.0` (Note TODO)
*/
var clickIntervalId = setInterval(
() => {
var button = document.querySelector('[data-testid=scan-more');
if (button == null) {
console.log("Clearing Interval as button does not exist")
clearInterval(clickIntervalId);
}
// TODO - Determine what to do when the entire dataset is scanned
// if (button.disabled) {
// console.log("Clearing Interval as button is disabled")
// clearInterval(intervalId);
// }
var loading_bar = document.querySelector('[data-testid=progress-key-list');
if (loading_bar == null) {
console.log("Loading next keys")
button.click();
}
else {
console.log("... waiting for last results to be loaded.\nRun 'clearInterval(clickIntervalId)' to stop this process")
}
},
200
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment