Skip to content

Commit

Permalink
Log text units exceeds max request only if there are active prompts f…
Browse files Browse the repository at this point in the history
…or the repository (#206)
  • Loading branch information
maallen authored Dec 11, 2024
1 parent de65daa commit 126e1b7
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ public class AITranslationService {

@Transactional
public void createPendingMTEntitiesInBatches(Long repositoryId, Set<Long> tmTextUnitIds) {
if (tmTextUnitIds.size() > maxTextUnitsAIRequest) {
logger.warn(
"Number of text units ({}) exceeds the maximum number of text units that can be sent for AI translation per request ({}). AI translation will be skipped.",
tmTextUnitIds.size(),
maxTextUnitsAIRequest);
return;
}
if (repositoryLocaleAIPromptRepository.findCountOfActiveRepositoryPromptsByType(
repositoryId, PromptType.TRANSLATION.toString())
> 0) {
if (tmTextUnitIds.size() > maxTextUnitsAIRequest) {
logger.warn(
"Number of text units ({}) exceeds the maximum number of text units that can be sent for AI translation per request ({}). AI translation will be skipped.",
tmTextUnitIds.size(),
maxTextUnitsAIRequest);
return;
}
createPendingMTEntitiesInBatches(tmTextUnitIds);
} else {
logger.debug("No active prompts for repository: {}, no job scheduled", repositoryId);
Expand Down

0 comments on commit 126e1b7

Please sign in to comment.