Skip to content

Commit

Permalink
fix: sequential upload for sb projects
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ committed Jun 11, 2024
1 parent e091e22 commit 3596787
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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

0 comments on commit 3596787

Please sign in to comment.