-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add async versions of functions #25
Comments
So, do you have an example of this? I'm not sure I'm 100% sure what you are talking about. |
Suppose I want to add parsed data to a pokemon in the database (which the porybox server has to do quite a lot, often multiple times per request). In order to retrieve the data, pkparse needs to load the following files:
All of these file accesses use It's mitigated slightly by the fact that |
Ah yes, that makes sense. 1 thing we could to that would be simple (but would increase ram usage in the short term) would be using require all to get node to cache all the files. It's a bit of a hack, but it would at least remove the issue partially right now, with very little change. |
@kamronbatman Assigning you here, as for the actual implementation details I'll let you work that out with @not-an-aardvark ✌️ |
So I realized that whenever we load data that we don't already have cached, we call
require
on a new file, which does synchronous filesystem IO and blocks the event loop. This prevents anything else from happening (e.g. requests to the server) while that's going on.We should probably add versions of the functions that load things asynchronously, and use those instead.
The text was updated successfully, but these errors were encountered: