opt(lua): Coordinate single-shard Lua evals in remote thread (#1845)

* opt(lua): !!WIP!! Coordinate single-shard Lua evals in remote thread

This removes the need for an additional (and costly) Fiber.
This commit is contained in:
Shahar Mike 2023-09-13 11:52:35 +03:00 committed by GitHub
parent ef0502238c
commit b91435e360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 48 additions and 6 deletions

View file

@ -378,6 +378,22 @@ TEST_F(MultiTest, Eval) {
EXPECT_EQ(resp, "12345678912345-works");
resp = Run({"eval", kGetScore, "1", "z1", "c"});
EXPECT_EQ(resp, "12.5-works");
// Multiple calls in a Lua script
EXPECT_EQ(Run({"eval",
R"(redis.call('set', 'foo', '42')
return redis.call('get', 'foo'))",
"1", "foo"}),
"42");
auto condition = [&]() { return service_->IsLocked(0, "foo"); };
auto fb = ExpectConditionWithSuspension(condition);
EXPECT_EQ(Run({"eval",
R"(redis.call('set', 'foo', '42')
return redis.call('get', 'foo'))",
"1", "foo"}),
"42");
fb.Join();
}
TEST_F(MultiTest, Watch) {