-
Notifications
You must be signed in to change notification settings - Fork 6
Why doesn't the API return data directly?
Jonathan Chan Kwan Yin edited this page May 28, 2022
·
1 revision
Things do happen. Sometimes the database is down, or it takes so long to return data, that the player joined before the player account information arrives at the server.
Therefore, when you request something about a player, the data do not exist on the server yet. Instead of making the whole server stop to wait for the database, we make the API asynchronous, i.e. the server will do other things and come back to you when the data arrives.
This means, if you are handling an event, the server will continue to execute the event without waiting for your data to return.
How to fix this? Try to fetch the data from cache, but remember that the data may be missing.