Skip to content

Commit

Permalink
Disable cacheHitSempahore if async execution is enabled.
Browse files Browse the repository at this point in the history
`cacheHitSemaphore` is used to throttle the number of concurrent cache checks to the number of CPU. With async execution, the size of underlying thread pool is already limited to the number of CPU making the semaphore unnecessary.

PiperOrigin-RevId: 627036668
Change-Id: I2f664ddd7c35b8081f7432147c88bbaee063a8ba
  • Loading branch information
coeuvre authored and copybara-github committed Apr 22, 2024
1 parent b83b48c commit 6fa7332
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,13 @@ void prepareForExecution(
freeDiscoveredInputsAfterExecution =
!trackIncrementalState && options.getOptions(CoreOptions.class).actionListeners.isEmpty();

this.useAsyncExecution = buildRequestOptions.useAsyncExecution;

this.cacheHitSemaphore =
options.getOptions(CoreOptions.class).throttleActionCacheCheck
(!this.useAsyncExecution && options.getOptions(CoreOptions.class).throttleActionCacheCheck)
? new Semaphore(ResourceUsage.getAvailableProcessors())
: null;

this.useAsyncExecution = buildRequestOptions.useAsyncExecution;
// Always use semaphore for jobs if async execution is enabled.
this.actionExecutionSemaphore =
(this.useAsyncExecution || buildRequestOptions.useSemaphoreForJobs)
Expand Down

0 comments on commit 6fa7332

Please sign in to comment.