Skip to content

Make /dm reload async and speed up menu lookups - #324

Open
Robin-qwerty wants to merge 1 commit into
HelpChat:mainfrom
Robin-qwerty:claude/relaxed-fermat-fjsevw
Open

Robin-qwerty wants to merge 1 commit into
HelpChat:mainfrom
Robin-qwerty:claude/relaxed-fermat-fjsevw

Conversation

@Robin-qwerty

Copy link
Copy Markdown

/dm reload used to do everything on the main thread: it parsed config.yml four times, rewrote it, and read and parsed every menu file, which caused an MSPT spike on servers with many or large menus.

The file reading and YAML parsing now run on an async thread. Only the cheap part stays on the main thread: building the menus from the parsed configs, swapping them in and registering their commands. Old menus keep working until the new ones are ready. A second reload while one is still running gets a "reload already in progress" message. /dm reload <menu> is async too, and now reports when a menu file fails to load.

Also:

  • Fix has_item name_ignorecase / lore_ignorecase calling the wrong setters, which made them do nothing and overwrite name_contains / lore_contains.
  • Look up menu open commands with a map instead of scanning every menu on each player command.
  • Look up a player's open menu with a map instead of scanning all open menus on each inventory click, open and close.
  • Parse action delay/chance tags without compiling a regex per line.
  • Close the streams used when creating example/default menu files.

/dm reload used to do everything on the main thread: it parsed config.yml
four times, rewrote it, and read and parsed every menu file, which caused
an MSPT spike on servers with many or large menus.

The file reading and YAML parsing now run on an async thread. Only the
cheap part stays on the main thread: building the menus from the parsed
configs, swapping them in and registering their commands. Old menus keep
working until the new ones are ready. A second reload while one is still
running gets a "reload already in progress" message. /dm reload <menu> is
async too, and now reports when a menu file fails to load.

Also:
- Fix has_item name_ignorecase / lore_ignorecase calling the wrong
  setters, which made them do nothing and overwrite name_contains /
  lore_contains.
- Look up menu open commands with a map instead of scanning every menu
  on each player command.
- Look up a player's open menu with a map instead of scanning all open
  menus on each inventory click, open and close.
- Parse action delay/chance tags without compiling a regex per line.
- Close the streams used when creating example/default menu files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PRt7tTMyPbFtdxfErt32UP
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.

2 participants