Conversation
eb474e7 to
228f18e
Compare
a8345e0 to
4e4d5a1
Compare
3b1cc60 to
6681553
Compare
| * prevents automatic activity completion on return and returns a client that can be used to | ||
| * complete the activity asynchronously. | ||
| */ | ||
| ActivityCompletionClient useLocalManualCompletion(); |
There was a problem hiding this comment.
This is an entirely new feature, do we need it and is this the interface we want to expose?
There was a problem hiding this comment.
I use it in the new tests and Temporal also exposed it. I think it should be fine to expose it and we can achieve function parity with them.
| result.getStartedTimestamp() - result.getScheduledTimestampOfThisAttempt()), | ||
| HistogramBuckets.HIGH_1MS_24H); | ||
| isSuccessful = true; | ||
| return new ActivityTask(result, pollSemaphore::release); |
There was a problem hiding this comment.
We need to prevent duplicate releases from users incorrectly using the useLocalManualCompletion. One way to do that would be to wrap pollSemaphore::release such that calling it a second time does nothing.
|
|
||
| public ActivityPollTaskBase(SingleWorkerOptions options) { | ||
| this.options = options; | ||
| // TODO: we need to share this semaphore with the locally dispatched activity poll task |
There was a problem hiding this comment.
Do they currently share a thread pool?
There was a problem hiding this comment.
oh, I think they don't share the pool.
|
|
||
| public static final int MAX_CONCURRENT_ACTIVITIES = 1; | ||
| public static final double TASK_LIST_ACTIVITIES_PER_SECOND = | ||
| 100.0; // change this to 0.0 after we add semaphore limit for locally dispatched activities |
There was a problem hiding this comment.
Oh, that's a clever workaround lol.
Code Review ✅ Approved 3 resolved / 3 findingsImplements MaxConcurrentActivityExecutionSize to prevent activity over-polling, resolving permit leaks and double-release issues found during review. ✅ 3 resolved✅ Bug: Semaphore not released on poll failure before metrics/tagging
✅ Bug: Semaphore permit leak when handle() throws an unexpected exception
✅ Edge Case: ActivityCompletionClientImpl allows double semaphore release
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
What changed?
pick temporalio/sdk-java#286
pick temporalio/sdk-java#291
Why?
Prevent polling an activity when the activity task executor pool is full. However, locally dispatched activity is not included in this PR because it requires big refactoring
How did you test it?
./gradlew test
Potential risks
Workflows can be stuck
Release notes
Documentation Changes