Skip to content

TradeLogService shutdown save: use DataOperator#updateCounted so a write to a deleted row stays a failure on every backend #52

Description

@wisdommen

The shutdown save of cached trade settings treats a write to a deleted row as a failure only on the JSON backend; switch it to the framework's counted update.

Why this is filed now

UltiKits/UltiTools-Reborn#558 (maintainer decision 2026-09-29, 「不写,并告诉调用方没写成」, in pull request UltiKits/UltiTools-Reborn#559) changes what DataOperator#update(T) does when no row has the entity's id: on JSON, SQLite and MySQL it writes nothing, logs one WARNING naming the table and id, and returns normally. Before, SQLite/MySQL also returned silently, but the JSON backend threw a raw NullPointerException — which this call site's broad catch turned into a logged failure (logged in TradeLogService#shutdown). After the framework change the call site sees success on every backend.

What to do (after UltiTools-Reborn#559 merges)

Replace the update(...) call at src/main/java/com/ultikits/plugins/trade/service/TradeLogService.java:131 (shutdown, saving settingsCache) with int written = operator.updateCounted(row) (added to DataOperator in 6.3.0) and keep treating written == 0 as a failure (log it as the existing catch does), so a row another writer deleted is not reported as saved. Test: an operator whose updateCounted returns 0 takes the failure path.


中文:框架 #558 之后,按不存在的 id 更新在各后端都不写、记一条警告并正常返回(此前 JSON 抛 NPE,被这里的宽泛 catch 当作失败)。框架合并后,本处改用 updateCounted,返回 0 仍按失败处理。

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions