Sleitnick / AeroGameFramework

AeroGameFramework is a Roblox game framework that makes development easy and fun. The framework is designed to simplify the communication between modules and seamlessly bridge the gap between the server and client.
https://sleitnick.github.io/AeroGameFramework/
MIT License
215 stars 57 forks source link

Wrap ProfileService studio check in coroutine #200

Closed ghost closed 3 years ago

ghost commented 4 years ago

ProfileService makes a datastore call when initializing which causes the metamethod to yield. Although this only occurs in studio, it causes the entire framework to break. Wrapping the call in a coroutine fixed the issue.

OverHash commented 4 years ago

What do you mean it yields during the metamethod? ProfileService should probably be enabled as a standalone module.

ghost commented 4 years ago

The Standalone setting that is provided does not change the fact that the module is required inside of a metamethod. Here is the function that loads modules: https://github.com/Sleitnick/AeroGameFramework/blob/43e7f969b87ce0aacca1db0f200a0578df12383c/src/ServerScriptService/Aero/Internal/AeroServer.server.lua#L177-L202

OverHash commented 4 years ago

I feel as though this PR should be in the ProfileService module, as the issue is actually a problem with the module.

Sleitnick commented 4 years ago

I think this might actually be more of an issue with the LazyLoadSetup function. The fact that it prevents yielding within Start is concerning. The whole point of Start being executed asynchronously is to allow yielding.

I think I might be able to use Thread.SpawnNow to escape from the metamethod issue. I'll do some tests.

MallocByte commented 3 years ago

Any update on this? We had to manually update our ProfileService file but this could confuse new users.

Sleitnick commented 3 years ago

Thanks for the PR. I decided to also update to latest ProfileService and made sure to include the coroutine.wrap() section. Done within https://github.com/Sleitnick/AeroGameFramework/pull/206