Skip to content

Chunk encoding cache - #1832

Open
Wakcli wants to merge 2 commits into
AllayMC:masterfrom
Origin-Net:chunk-encoding-cache
Open

Wakcli wants to merge 2 commits into
AllayMC:masterfrom
Origin-Net:chunk-encoding-cache

Conversation

@Wakcli

@Wakcli Wakcli commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

stop reencoding the same chunk for every player
Ecode once, reuse it, and don't let saving lag the server.

PREF fix (PR 2/9)

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 43 complexity

Metric Results
Complexity 43

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@IWareQ

IWareQ commented Aug 30, 2026

Copy link
Copy Markdown
Member

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T13:08:20.723452Z 7e12283 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e12283e76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

} else {
next = previous.handle((v, t) -> null).thenRunAsync(() -> writeEntitiesAsync(chunkX, chunkZ, dimensionType, entityNbt), Server.getInstance().getVirtualThreadPool());
}
next.whenComplete((v, t) -> entityWriteChains.remove(key, next));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Publish the chain before registering its cleanup

When a fast entity write—especially an empty-map chunk-unload write—finishes before this compute callback returns, whenComplete executes immediately while the map still contains either the old value or ConcurrentHashMap's reservation rather than next. The conditional removal therefore fails, after which compute installs the already-completed future permanently; over a long-running server, affected chunk keys accumulate in entityWriteChains without bound. Register the cleanup only after the computed future has been published, or otherwise ensure a completion that races publication performs a subsequent removal.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants