perf(channelserver): move UserBinary and minidata to memory-only

UserBinary type1-5 and EnhancedMinidata are transient session state
resent by the client on every login. Persisting them to the DB on
every set was unnecessary I/O. Both are now served exclusively from
server-scoped in-memory maps (userBinaryParts, minidataParts).

Includes a schema migration to drop the now-unused type2/type3
columns from user_binary and minidata column from characters.

Ref #158
This commit is contained in:
Houmgaor
2026-02-19 00:05:20 +01:00
parent b2b1c426a5
commit 99e544e0cf
6 changed files with 38 additions and 46 deletions

View File

@@ -81,23 +81,23 @@ func TestHandleMsgSysGetUserBinary_NotInCache(t *testing.T) {
server.userBinaryParts = make(map[userBinaryPartID][]byte)
session := createMockSession(1, server)
// Don't populate cache - will fall back to DB (which is nil in test)
pkt := &mhfpacket.MsgSysGetUserBinary{
AckHandle: 12345,
CharID: 100,
BinaryType: 1,
}
// This will panic when trying to access nil db, which is expected
// in the test environment without database setup
defer func() {
if r := recover(); r != nil {
// Expected - no database in test
t.Log("Expected panic due to nil database in test")
}
}()
handleMsgSysGetUserBinary(session, pkt)
// Should return a fail ACK (no DB fallback, just cache miss)
select {
case p := <-session.sendPackets:
if len(p.data) == 0 {
t.Error("Response packet should have data")
}
default:
t.Error("No response packet queued")
}
}
func TestUserBinaryPartID_AsMapKey(t *testing.T) {