Delays in studio tests due to blocking API calls

When I stop a test, Studio needs to wait for all blocking API calls in the game’s BindToClose callbacks to finish (for example, code that saves all players’ data). Similarly, it may take longer for me to test my game if game systems wait for blocking API calls, and this may include third-party modules which I have little control over. Certain engine features also require making requests which may be delayed, such as loading avatars, or applying appearances via HumanoidDescriptions. These issues are particularly noticeable when Roblox is having server issues, but they also just add some extra delay to everything in normal circumstances.

Common solutions to this on the developer end include things like:

  • Creating mocked versions of APIs like DataStoreService
  • Building in ways to disable certain systems when they are not relevant for testing
  • Using a premade dummy character model instead of a character model loaded by the engine

But these require modifying all the code which uses these things, which is especially frustrating with third-party code. And also developer-made copies of these things are prone to bugs or behavioral differences from the originals.

One possible solution is to just have simple built-in versions of these solutions, such as a button to toggle mocked DataStoreService or to avoid character loading delays. A downside of this would be that any systems which rely on dynamic configuration based on blocking APIs would stop working. To aid in this, perhaps it would help to have ways to instantaneously modify mocked data storage / configurations (such as DataStores or avatars) via script, and potentially in edit mode as well (to avoid issues related to race conditions which is likely in a game with lots of separate codebases, and to allow instances to be “baked” in to the game without making any external requests which could fail or cause delays). Though they would increase the API surface, I believe these things would also assist us in other ways by enabling things like easily testing sensitive DataStore code for different variations of data and so on.

1 Like