MeikelLP / quantum-core-x

Metin2 open source server implementation
https://meikellp.github.io/quantum-core-x/
Mozilla Public License 2.0
35 stars 9 forks source link

Execute cache & db updates in background #29

Open MeikelLP opened 11 months ago

MeikelLP commented 11 months ago

Database and cache write operations are "slow". They cannot be waited/awaited on on hot paths.

Read operations must be awaited but that's fine as they're usually only done once at the start or when instancing new objects. Write operations on the other hand can be performed in background as they're are used for persistence or server-to-server communication but are not required for the game logic to be awaited on.

Thus a non-blocking mediator approach should be used to keep the hot path clean of blocking statements.

This will also fix several // TODOs