Skip to content

Commit

Permalink
Make custom thread pool size configurable.
Browse files Browse the repository at this point in the history
Fix processing build request in one thread.
  • Loading branch information
ekharkunov committed Oct 16, 2024
1 parent 0d18a16 commit 93db75c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/src/main/java/com/defold/extender/AsyncBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void writeExceptionToFile(Exception exception, File file) {
}
}

@Async
@Async(value="extenderTaskExecutor")
public void asyncBuildEngine(MetricsWriter metricsWriter, String platform, String sdkVersion,
File jobDirectory, File uploadDirectory, File buildDirectory) throws IOException {
String jobName = jobDirectory.getName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.defold.extender.tracing;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
Expand All @@ -24,6 +25,9 @@
@Configuration(proxyBeanMethods = false)
class ExtenderExecutor {

@Value("${extender.tasks.executor.pool-size:35}")
private int executorPoolSize;

@Configuration(proxyBeanMethods = false)
@EnableAsync
static class AsyncConfig implements AsyncConfigurer, WebMvcConfigurer {
Expand Down Expand Up @@ -63,6 +67,7 @@ public ScheduledExecutorService getScheduledExecutor() throws IllegalStateExcept
return ContextScheduledExecutorService.wrap(super.getScheduledExecutor());
}
};
threadPoolTaskScheduler.setPoolSize(executorPoolSize);
threadPoolTaskScheduler.initialize();
return threadPoolTaskScheduler;
}
Expand Down

0 comments on commit 93db75c

Please sign in to comment.