serverless-redis-http icon indicating copy to clipboard operation
serverless-redis-http copied to clipboard

Multi-execs from concurrent users not working

Open smartinio opened this issue 9 months ago • 7 comments

The following code snippet works towards actual Upstash but not towards serverless-redis-http

Repro

import { Redis } from '@upstash/redis'

const redis = Redis.fromEnv()

await Promise.all(['a', 'b', 'c'].map(async (key) => {
  const multi = redis.multi()
  multi.set(key, 'foo')
  await multi.exec()
}))

console.log(await redis.mget('a', 'b', 'c'))

Expected

[ "foo", "foo", "foo" ]

Observed

UpstashError: ERR MULTI calls can not be nested, command was: [["set","b","foo"]]
      at new u (/Users/sam/redis-http-repro/node_modules/@upstash/redis/chunk-DKKYFKP2.mjs:1:42)
      at /Users/sam/redis-http-repro/node_modules/@upstash/redis/chunk-DKKYFKP2.mjs:1:1597

smartinio avatar May 01 '24 17:05 smartinio