Copilot commented on code in PR #16070:
URL: https://github.com/apache/grails-core/pull/16070#discussion_r3685008918


##########
grails-data-neo4j/grails-datastore-gorm-neo4j/src/test/groovy/grails/gorm/tests/OptimisticLockingSpec.groovy:
##########
@@ -137,7 +141,8 @@ class OptimisticLockingSpec extends GormDatastoreSpec {
         } catch (InterruptedException e) {
             // ignore
         }
-        sleep 2000 // heisenbug
+        // Same headroom rationale as "Test optimistic locking" above.

Review Comment:
   In this example the background thread is started with `Thread.start { ... 
}.join(2000)`, which can return before the thread has completed (timeout). The 
updated comment implies the sleep is only durability headroom (as in the first 
test where `.join()` guarantees completion), but here the sleep may still be 
masking a race with thread completion. Consider joining with a longer bounded 
timeout and asserting the thread finished so the comment and synchronization 
are accurate and the test is less timing-sensitive.



-- 
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]

Reply via email to