123123213weqw commented on PR #5755: URL: https://github.com/apache/rocketmq-dashboard/pull/5755#issuecomment-6123349170
@lizhimins Both asks are in ([2a362c76](https://github.com/apache/rocketmq-dashboard/commit/2a362c76)): 1. Went with your option (b): the guard now lives in the write itself. `AiRunRepository.updateWhileNonTerminal` runs `UPDATE … WHERE id = ? AND status IN ('QUEUED','RUNNING')`, `markRunning` reports whether it matched a row, and `execute` bails out when it did not. Your diagnosis stood — the earlier in-memory check only narrowed the window, since a stop can land between any check and the database write; it cannot slip between the guard and the write inside one UPDATE statement. The comment now says exactly that. 2. The regression test stays in `AiRunServiceTest` for now, because the deferred-executor harness and the recording repository mock it needs live there — happy to extract a dedicated `AiRunExecutorTest` if you prefer the executor's contract in its own class. The repository mock mirrors the SQL guard (a RUNNING write only records when the last recorded row state is non-terminal), so the test still fails with `RUNNING` on the old code. The class is 23/23 on this branch merged onto the current `rocketmq-studio`. On the #5196 adjacency: understood that you'll decide them together; this branch's guarded write composes with a request-thread fix either way. (The PR description was rewritten too — literal `\n` sequences gone, "The fix" now describes the guarded write.) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
