Skip to content

Enable concurrent payload visiting#244

Open
jmaeagle99 wants to merge 1 commit intotemporalio:masterfrom
jmaeagle99:concurrent
Open

Enable concurrent payload visiting#244
jmaeagle99 wants to merge 1 commit intotemporalio:masterfrom
jmaeagle99:concurrent

Conversation

@jmaeagle99
Copy link
Copy Markdown
Contributor

@jmaeagle99 jmaeagle99 commented Apr 2, 2026

What changed?

Allow payload visitor to optionally concurrently visit payloads.

  • Concurrency limit of 0 (the default) or 1 preserves the existing sequential visitor behavior without using goroutines.
  • Concurrency limit of more than 1 leverages goroutines to visit payloads. The semantics for visiting payloads is the same as they are in the sequential visiting algorithm (e.g. all payloads in a Payloads are visited together and count as 1 visit). Outside of concurrency, the only semantic difference is that cancellation will short-circuit graph traversal (regardless of the concurrent visitors returning an error or not) whereas the sequential mode relied on the visitor to return an error.

Why?

To enable more efficient visiting behavior when needed. For example, if the visitor were used to upload or download payloads to/from external storage, there should be some concurrency enabled to avoid sequential uploads and downloads.

How did you test it?

More unit tests that ensure concurrency is opt-in, that it doesn't go over the concurrency limit, and that concurrency is actually exhibited.

Potential risks

Low; this is an opt-in setting on the payload visitor is off by default. The sequential path has been preserved without using goroutines.

@jmaeagle99 jmaeagle99 requested review from a team as code owners April 2, 2026 04:16
Only spawn gorountines after semaphore is acquired

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant