mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-07-24 02:57:23 -04:00
4c8ce71c38
# Description of Changes Add several new tests of concurrency behavior re: procedures. The new tests are in the SDK tests, 'cause I thought the easiest way to observe this behavior was by connecting a client to a database and calling some functions in it. This is yet another mild misuse of the SDK test suite, as the behavior in question is not in the SDK, it's in the host. The tests also have a new module/client pair added, as we don't (yet?) expose `procedure_sleep_until` to any module languages other than Rust, so we can't implement the same test in any other languages. ### `procedure_reducer_interleaving` Verifies that a procedure and a reducer can run concurrently, with the procedure cooperatively yielding using `ctx.sleep_until`. Uses two separate connections due to #4954 . ### `procedure_reducer_same_client_interleaved` Same as previous, but with only a single connection. Now that #4954 is closed, this has the same semantics as previous. ### `procedure_concurrent_with_scheduled_reducer` Verifies that a non-scheduled procedure can schedule a reducer and then sleep, and the reducer will execute before the procedure wakes back up. ### `scheduled_procedure_scheduled_reducer_not_interleaved` Schedules a procedure and a reducer, which you might expect to execute concurrently, but don't in a way similar to `procedure_reducer_same_client_not_interleaved`. This is the behavior that kicked off this whole thing. The scheduler subsystem behaves like a single client, in the sense that it waits for a single function to terminate before scheduling the next function. # API and ABI breaking changes N/a # Expected complexity level and risk 1 - tests # Testing - [x] Ran the tests! I didn't bother intentionally breaking the host to verify that the tests would fail. It feels pretty apparent to me based on just the test code that we won't see false negatives.
sdk-test-procedure-concurrency Rust test
This module isolates procedure concurrency behavior that currently only has Rust module coverage.
It is separate from sdk-test-procedure so the shared
procedure test suite can continue targeting other module languages without also
requiring ctx.sleep_until support.