title: Redis SCAN not giving all matches in NodeJS
body: <p>I am using a Node.JS script with the <code>redis</code> npm package to retrieve all the Redis keys that match a pattern <code>animals:toFeed:*</code>. An example of a match will be the key <code>animals:toFeed:17ed160f59c5b31caf7e741a4e62cb7785414cd</code>.</p>
  
  <p>Using the code below, there can be 10 matches but the code will only return a few like 2-3. What might be the issue, and how can we fix it?</p>
  
  <p><em>Using Redis 4.0.11, Node.js 8.11.3, redis 2.8.0 npm package</em></p>
  
  <pre><code>async function scanAsync(cursor, pattern, results) {
      return redis.scanAsync(cursor, 'MATCH', pattern, 'COUNT', '10')
          .then(function(reply) {
              cursor = reply[0]
              if(cursor === '0') {
                  console.log('Scan complete')
              } else {
                  console.log('Match #', i)
                  let keys = reply[1]
                  keys.forEach(function(key, i) {
                      results.push(key)
                  })
                  return scanAsync(cursor, pattern, results)
              }
          })
  }
  
  let keys = []
  let prefix = 'animals:toFeed:*'
  await scanAsync('0', prefix, keys) 
  </code></pre>
  
  <h2>Update</h2>
  
  <ol>
  <li>Restarted redis. Still having incomplete SCAN results</li>
  <li>Deleted all keys that matches the pattern and added some keys back. Now everything is returned when doing the SCAN. After an hour of playing, it starts returning incomplete results once more. Repeating this no longer works to fix the problem.</li>
  </ol>