redis/ioredis

difference Between multi.promise.exec() and multi.exec() in ioredis

Geschlossen

#1.968 geöffnet am 10.03.2025

 (7 Kommentare) (1 Reaktion) (1 zugewiesene Person)TypeScript (1.069 Forks)batch import
help wantedstale

Repository-Metriken

Stars
 (12.302 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 3T 5h) (5 gemergte PRs in 30 T)

Beschreibung

I am currently using Redis with multi.exec(), but I noticed that the result format differs when using multi.promise.exec().

multi.promise.exec() appears to support Bluebird promises, but the returned result format is different from multi.exec(). I expected both to return the same output, but there seems to be a difference. Since I primarily want to use multi.exec(), I’d like to understand whether this difference is intentional and if there’s a recommended approach to ensure consistency.

Would appreciate any insights on this

const multi = redis.multi();
multi.zrevrank(key, id);
multi.hget(key, id);
const result1 = await multi.promise.exec() // [null, null]

const multi2 = redis.multi();
multi2.zrevrank(key, id);
multi2.hget(key, id);
const result = await multi.exec(); // [[null, null], [null, null]]

Contributor Guide