Skip to content

Commit

Permalink
[backend] Fix inject resolution before execution (#2545)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelHassine committed Feb 26, 2025
1 parent dd64bc8 commit 5ac9a0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import org.hibernate.Hibernate;
import org.springframework.web.multipart.MultipartFile;

@Getter
Expand Down Expand Up @@ -39,8 +40,11 @@ public ExecutableInject(
this.direct = direct;
this.users = users;
this.teams = teams;
this.teams.forEach(team -> Hibernate.initialize(team.getTags()));
this.assets = assets;
this.assets.forEach(asset -> Hibernate.initialize(asset.getTags()));
this.assetGroups = assetGroups;
this.assetGroups.forEach(assetGroup -> Hibernate.initialize(assetGroup.getTags()));
this.teamSize = teams.size();
this.documentSize = injection.getInject().getDocuments().size();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,15 @@ public List<ExecutableInject> getInjectsToRun() {
.sorted(Inject.executionComparator)
.map(
inject -> {
// TODO This is inefficient, we need to refactor this loop with our own query
Hibernate.initialize(inject.getTags());
Hibernate.initialize(inject.getUser());
return new ExecutableInject(
true,
false,
inject,
getInjectTeams(inject),
inject.getAssets(),
inject.getAssets(), // TODO There is also inefficient lazy loading inside this get function
inject.getAssetGroups(),
usersFromInjection(inject));
});
Expand Down

0 comments on commit 5ac9a0f

Please sign in to comment.