Skip to content

Use latches in PaymentSheet load parallelism test#13327

Open
amk-stripe wants to merge 4 commits into
masterfrom
latency-use-cl-for-tests
Open

Use latches in PaymentSheet load parallelism test#13327
amk-stripe wants to merge 4 commits into
masterfrom
latency-use-cl-for-tests

Conversation

@amk-stripe

Copy link
Copy Markdown
Collaborator

Committed-By-Agent: codex

Summary

Use latches in PaymentSheet load parallelism test

Motivation

Make code easier to reason about and response to this code review comment: #13242 (comment)

amk-stripe and others added 2 commits June 30, 2026 15:12
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@amk-stripe amk-stripe marked this pull request as ready for review July 1, 2026 23:31
@amk-stripe amk-stripe requested review from a team as code owners July 1, 2026 23:31
Collections.synchronizedList(mutableListOf())

private data class RequestEvent(val request: Request, val arrivalNanos: Long)
private lateinit var requestTracker: RequestTracker

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this go into the "scenario"? I think we could add some methods on that to do some of the validations.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

try {
block()
} finally {
requestTracker.recordFinished(request)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little risky, should we add a catch + failed requests?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the risk you see? My understanding is that since there's no catch, the exception thrown in block() would still get thrown and lead to the test failing. The requestTracker.recordFinished just ensures that anything waiting on the finished CountDownLatch is unblocked if there's an exception thrown

amk-stripe and others added 2 commits July 6, 2026 10:02
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants