Search code examples
redisnode-redishubot

redis-cli FLUSHALL and FLUSHDB return ok but do nothing after Hubot restores redis


On ubuntu 16.04. Interacting with a local redis instance via redis-cli. Working with a node hubot script which uses redis as its primary data store.

when I type keys * I get a single key hubot:storage

so I FLUSHALL and get an ok response. But if the Hubot is running or else as soon as it turns on, it restores the value of that key immediately so I can never delete it.

I'v used the info command to try to see if it is persisting on some other redis instance and I've cleared all backup files from /var/redis. Basically I can't figure out where this data is being stored to keep getting restored from.

Any advice regarding how I could clear this out or where Hubot may be caching this?

It seems to be related to this code: https://github.com/hubotio/hubot-redis-brain/blob/master/src/redis-brain.js specifically the chunk at line 49 is what gets called before each restore.


Solution

  • Steps

    1. Stop hubot
    2. Flush redis (important that this is done while hubot is NOT running)
    3. Start hubot

    The reasoning is that hubot has an in-memory representation of the brain and will write it out to redis at intervals. Perhaps a nicer solution to this which would help during script development would be a command that can empty the brain and save that, but I can't see an obvious API for that in either robot.brain or hubot-redis-brain