This fixes an edge case where one of the callbacks could yield right before or during game:BindToClose which means the save won't have started and AutoSave won't wait for the document to close.
This could be fixed without restricting yielding but there is another awkward API issue this fixes: For example, if beforeSave yields and :close is called during the yield, the close will throw an error since :close can't be called during the beforeSave callback. This could also technically be fixed by checking the coroutine.status of the beforeSave thread before throwing this error. However, if the :close didn't yield in its callbacks the close request would happen before the save and that would result in a save happening after the close which is not good.
We may find solutions to these edge cases but I feel that it's more correct to not allow yielding.
This fixes an edge case where one of the callbacks could yield right before or during
game:BindToClose
which means the save won't have started andAutoSave
won't wait for the document to close.This could be fixed without restricting yielding but there is another awkward API issue this fixes: For example, if
beforeSave
yields and:close
is called during the yield, the close will throw an error since:close
can't be called during thebeforeSave
callback. This could also technically be fixed by checking thecoroutine.status
of thebeforeSave
thread before throwing this error. However, if the:close
didn't yield in its callbacks theclose
request would happen before thesave
and that would result in a save happening after the close which is not good.We may find solutions to these edge cases but I feel that it's more correct to not allow yielding.