Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 26 05:12
    slaveofcode commented #1203
  • Feb 25 15:06
    EwenQuim closed #1291
  • Feb 25 15:06
    EwenQuim commented #1291
  • Feb 25 15:01
    kbkk edited #1140
  • Feb 25 14:59
    kbkk synchronize #1142
  • Feb 25 14:16
    luin labeled #1289
  • Feb 25 14:16
    luin labeled #1289
  • Feb 25 14:15
    luin commented #1291
  • Feb 25 13:56
    ioredis-robot labeled #1283
  • Feb 25 13:56
    ioredis-robot commented #1283
  • Feb 25 13:55

    ioredis-robot on v4.23.0

    (compare)

  • Feb 25 13:55

    ioredis-robot on master

    chore(release): 4.23.0 [skip ci… (compare)

  • Feb 25 13:53

    luin on master

    feat: add support for DNS SRV r… (compare)

  • Feb 25 13:53
    luin closed #1283
  • Feb 25 13:49
    luin synchronize #1283
  • Feb 24 14:56
    luin commented #1283
  • Feb 24 14:45
    artur-ma commented #1283
  • Feb 23 18:47
    leibale synchronize #1283
  • Feb 23 18:01
    leibale synchronize #1283
  • Feb 23 17:11
    EwenQuim opened #1291
Christian Roy
@roychri
notify-keyspace-events xK to only enable expired events
I found this
do you just include that line in the file
and mount it?
Christian Roy
@roychri
If you use that image (and not the one you first showed me) then yes.
But that image is not the official image
If you use the official image, just make an empty file with that one line, mount it and change CMD to use your file
OR, you could also enable it by your app
once connected send CONFIG SET notify-keyspace-events xK
and that will enable it
without having to mount any file
Jason Shin
@JasonShin
yeah right
i chose the config mount approach
but having a problem
Christian Roy
@roychri
This is a docker discussion, not an ioredis discussion... mind to continue this in docker/docker room?
Jason Shin
@JasonShin

I've mounted redis.conf to /usr/local/etc/redis/redis.conf

and it contains notify-keyspace-events Ex

Code:

redis.set('test', 12, 'EX', 1);
console.log(await redis.get('test')); // return 12
redis.subscribe('__keyevent@0__:expire', (x, y, c, v, b) => {
    console.log('zz', x, y, c, v, b);
});

The console.log return zz null 1 undefined undefined undefined for the first time then errors

error: Connection in subscriber mode, only subscriber commands may be used
error: Error: Connection in subscriber mode, only subscriber commands may be used
sorry this is more of an ioredis question I believe
Christian Roy
@roychri
oh, yes it is. sorry.
So the error message says it.
You cannot use "subscribe" on the same connection that you use other commands.
Make a new connection for your subscribe.
redisSubscribe = new Redis();
or whatever
Jason Shin
@JasonShin
ahh right
Jason Shin
@JasonShin
hey @roychri I still do not receive any subscribe event for the key expire
what's wrong with above code?
Creating a new instance as redisSubscriber resolved the connection issue
however, there's no expire events received in the subscribe block
Christian Roy
@roychri
Are you using docker run or docker-compose or something else?
Jason Shin
@JasonShin
I'm using docker compose
Christian Roy
@roychri
docker-compose exec redis-master redis-cli config get notify-keyspace-events
Replace redis-master with the name of the redis service in your compose file. What do you get?
Jason Shin
@JasonShin
1) "notify-keyspace-events"
2) ""
ahh...
T_T !!
im dumb
Christian Roy
@roychri
Did you change the command in your docker-compose.yaml ?
Jason Shin
@JasonShin
nope
Christian Roy
@roychri
You have to tell redis to use your new config file
Jason Shin
@JasonShin
yeah right
1) "notify-keyspace-events"
2) "xE"
ok cool
Christian Roy
@roychri
I do not think xE will send the __keyevent@0__:expire event but rather the __keyevent@0__:test event (with the name of your key in the event name).
If you want __keyevent@0__:expire then you should set it to xK I think.
Jason Shin
@JasonShin
I see
Christian Roy
@roychri
But Maybe your right and im mixing them up, tias
Jason Shin
@JasonShin
still, no events
1) "notify-keyspace-events"
2) "xK"
Christian Roy
@roychri
and no events with xE either?
Jason Shin
@JasonShin
nope
I only get a very first
zz null 1 undefined undefined undefined