Refactor ActivityMap#39
Conversation
|
Very cool and clear as always |
|
|
||
| record ChunkCoord (short worldId, int x, int z) { | ||
| @Override | ||
| public boolean equals(Object obj) { |
There was a problem hiding this comment.
There's no need for .equals() or .hashCode() on records unless you're doing something very custom
There was a problem hiding this comment.
equals - agree
hashCode - I want to have here my own hashing function
| sender.sendMessage("In-memory activities: " + longToStr(stat.loadedActivities)); | ||
|
|
||
| sender.sendMessage(ChatColor.YELLOW + "[ActivityMap] region load statistics:"); | ||
| sender.sendMessage(Component.text("[ActivityMap] region load statistics:").color(NamedTextColor.YELLOW)); |
There was a problem hiding this comment.
It's better to do Component.text("Message", colour);
What you're doing here is creating a new component with the text "[ActivityMap] region load statistics:", then creating another component that has that text but also the colour YELLOW. So you're creating two components here, not one.
There was a problem hiding this comment.
This function will be called like 0 - 4 times per day so I think doubled components are not a problem here.
I like a separate color more :)
There was a problem hiding this comment.
Oh yeah, it's not the end of the world. Since you aren't fussed and prefer the separation, you could also do
Component.text()
.color(NamedTextColor.YELLOW)
.content("[ActivityMap] region load statistics:")
.build()as Component.text() returns a builder which you can modify as much as you like.
|
This adds a significant amount of complexity for what is essentially optimistically loading chunks from the database, why is this necessary? |
We have at the moment 3 main problems:
For example, the recent RB problems were related indirectly to ActivityMap - ActivityMap occupied all connections, Citadel was not able to load reinforcements, this slowed down loading ChunkMeta and RB was not able to get data in time. |
The goal of this change is to improve performance of the server and decrease amount of used resources (first of all load on the database)