mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-12 19:05:47 +02:00
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:
parent
ef0502238c
commit
b91435e360
8 changed files with 48 additions and 6 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue