cult-of-coders / redis-oplog

Redis Oplog implementation to fully replace MongoDB Oplog in Meteor
MIT License
375 stars 80 forks source link

Publish/subscribe doesn't work when redis-oplog disabled #361

Open afrokick opened 3 years ago

afrokick commented 3 years ago

Run it on local machine. RedisOplog Version: 2.0.5 My config:

  "redisOplog": {
    "redis": {
      "port": 6379,
      "host": "127.0.0.1"
    },
    "retryIntervalMs": 10000,
    "mutationDefaults": {
      "optimistic": false,
      "pushToRedis": false
    },
    "overridePublishFunction": false,
    "debug": true
  }

As you can see, I turned off pushToRedis and overridePublishFunction.

When I subscribe to my user on tab1 and then change it on tab2, it doesn't update on tab1.

When I remove redis-oplog package, all works fine.

edemaine commented 3 years ago

Indeed, the code no longer responds to overridePublishFunction, as reported in #323. (This issue seems like a duplicate of that one.)

Instead, you can turn off/disable Redis Oplog by not setting redisOplog at all (or setting it to null).

afrokick commented 3 years ago

@edemaine but I want to use Vent, so I need a config to connect to Redis

edemaine commented 3 years ago

That does seem like a good reason to add overridePublishFunction support back (and I see #359 is your issue for this -- again, this issue seems like a duplicate).

I believe one could just wrap this line in if (Config.overridePublishFunction) but I haven't tested. (It also seems likely that all following lines in that function should be wrapped by the same if, because you probably don't care about subscriptions in this case. But https://github.com/cult-of-coders/redis-oplog/commit/8d6dd336b3e8b65f9e946ec01643368bc074042b#diff-3e18cf2294c02344381d224486ff0d2dL31-L34 suggests this isn't the old behavior.)

I'll try making a PR.