feat: Add timeout arguments to WaitForData and Flush - #9
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the server-side lifecycle/persistence APIs to accept explicit timeout controls for WaitForData and Flush, and updates the persistence implementation so WaitForData can reliably time out even when no further state transitions occur (e.g., under LoadFailurePolicy = "Wait" during prolonged outages).
Changes:
- Add optional
timeoutparameter toData.WaitForData/Persistence.WaitForData(default 60s) and enforce it via a deadline-based wait. - Add optional
Timeoutoption toData.Flush/Persistence.Flush(default 15s) by forwarding it toAwaitSave. - Add lifecycle specs covering the new timeout behaviors and update typecheck/docs to match the new API surface.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/TypeCheck.luau | Updates typecheck usage to pass timeout to WaitForData and Timeout to Flush. |
| test/Specs/Lifecycle.spec.luau | Adds tests ensuring WaitForData/Flush honor explicit timeouts and don’t hang. |
| src/Server/Persistence.luau | Implements deadline-based waiting for WaitForData and forwards opts.Timeout through Flush. |
| src/Server/init.luau | Updates server API signatures and docstrings for WaitForData(timeout?) and Flush({ Timeout? }). |
| src/init.luau | Updates exported type definitions for WaitForData and Flush options. |
| README.md | Updates example comment to reflect default timeout wording. |
| docgen/guides/lifecycle.md | Updates lifecycle guide to document WaitForData(player, timeout?). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.