Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sequential upload for sb projects #815

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {

})
.collect(Collectors.toList());
ConcurrencyUtil.executeAndWait(taskss, debug);
if (isStringsBasedProject) {
ConcurrencyUtil.executeAndWaitSingleThread(taskss, debug);
} else {
ConcurrencyUtil.executeAndWait(taskss, debug);
}
})
.collect(Collectors.toList());
ConcurrencyUtil.executeAndWaitSingleThread(tasks, debug);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
})
.collect(Collectors.toList());
}
ConcurrencyUtil.executeAndWait(tasks, debug);
if (isStringsBasedProject) {
ConcurrencyUtil.executeAndWaitSingleThread(tasks, debug);
} else {
ConcurrencyUtil.executeAndWait(tasks, debug);
}

if (containsErrors.get()) {
throw new RuntimeException(RESOURCE_BUNDLE.getString("error.execution_contains_errors"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ private ConcurrencyUtil() {
*/
public static void executeAndWait(List<Runnable> tasks, boolean debug) {
run(tasks, CROWDIN_API_MAX_CONCURRENT_REQUESTS, tasks.size() * 2, debug);

}

public static void executeAndWaitSingleThread(List<Runnable> tasks, boolean debug) {
run(tasks, 1, 100, debug);
}

private static void run(List<Runnable> tasks, int threadQnt, int minutesWait, boolean debug) {
if (Objects.isNull(tasks) || tasks.size() == 0) {
if (Objects.isNull(tasks) || tasks.isEmpty()) {
return;
}
ExecutorService executor = CrowdinExecutorService.newFixedThreadPool(threadQnt, debug);
Expand Down
Loading