Skip to content

Commit 5b9fdb4

Browse files
committed
patch(modeling-commons): disable model stats due to N+1 query. Added to TODO.
1 parent a8c5405 commit 5b9fdb4

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

apps/modeling-commons-backend/src/modules/model/queries/get-model-card.query.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,23 @@ export default function makeGetModelCardQuery({
4242
? await fileService.getUrl(latestWithTags.previewImageFileKey)
4343
: null;
4444

45-
const [interactionCounts, likedByMe] = await Promise.all([
46-
modelInteractionRepository.countsByKindForModel(model.id),
47-
viewerUserId
48-
? modelLikeRepository.existsFor(model.id, viewerUserId)
49-
: Promise.resolve(false),
50-
]);
45+
// const [interactionCounts, likedByMe] = await Promise.all([
46+
// modelInteractionRepository.countsByKindForModel(model.id),
47+
// viewerUserId
48+
// ? modelLikeRepository.existsFor(model.id, viewerUserId)
49+
// : Promise.resolve(false),
50+
// ]);
51+
52+
// It is causing N+1 query problem. We swap to no-op
53+
// until a patch is implemented.
54+
// -- Omar Ibrahim, May 26 26
55+
const likedByMe = false;
56+
const interactionCounts = {
57+
view: 0,
58+
run: 0,
59+
download: 0,
60+
share: 0,
61+
};
5162

5263
return {
5364
model: modelMapper.toResponse(model),

0 commit comments

Comments
 (0)