lettuce icon indicating copy to clipboard operation
lettuce copied to clipboard

Transaction Discard function seems not work when use reactive command

Open ChainFoxBot opened this issue 2 years ago • 0 comments

Describe the solution you'd like

RedisReactiveCommands<String, String> reactive = client.connect().reactive();
reactive.watch("key").subscribe();
reactive.multi().subscribe(multiResponse -> {
    reactive.set("key", "1").subscribe();
    reactive.incr("key").subscribe();   // Assume it gets RuntimeException
    reactive.exec().subscribe();
}, e -> reactive.discard().subscribe());

The program above can not rollback if command incr gets wrong. How can i discard the transaction above ?

ChainFoxBot avatar Jun 16 '22 01:06 ChainFoxBot