bito-code-review[bot] commented on PR #16070:
URL: https://github.com/apache/grails-core/pull/16070#issuecomment-5134345749
<!-- Bito Reply -->
The suggestion to replace `sleep` with a bounded `join()` is technically
sound and improves test reliability. Using `thread.join(timeout)` combined with
an assertion that the thread has actually finished (e.g., `assert
thread.isAlive() == false`) ensures the test waits for the thread to complete
rather than relying on an arbitrary sleep duration, which is prone to race
conditions in loaded environments.
**grails-data-neo4j/grails-datastore-gorm-neo4j/src/test/groovy/grails/gorm/tests/OptimisticLockingSpec.groovy**
```
def t = Thread.start { ... }
t.join(5000)
assert !t.isAlive()
```
--
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]