Skip to content

Commit

Permalink
fix(replays): fix slow replay list query
Browse files Browse the repository at this point in the history
  • Loading branch information
sunehs committed Jul 6, 2024
1 parent e882fe4 commit 48f7410
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/api/replay.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const getReplays = async (

// Filter by level pack
let packLevels = [];
if (LevelPackIndex) {
if (LevelPackIndex && LevelPackIndex !== '0') {
packLevels = await LevelPackLevel.findAll({
attributes: ['LevelIndex'],
where: {
Expand Down Expand Up @@ -315,7 +315,7 @@ const getReplays = async (
AND replay_tags.TagIndex IN (${excludedTags.join()})) = 0`;
}

const data = await Replay.findAndCountAll({
const data = await Replay.findAll({
limit: searchLimit(limit),
offset: searchOffset(offset),
where,
Expand Down Expand Up @@ -362,7 +362,9 @@ const getReplays = async (
model: Level,
attributes: ['LevelName'],
as: 'LevelData',
where: levelWhere,
...(Object.keys(levelWhere).length && {
where: levelWhere,
}),
},
{
model: Kuski,
Expand Down

0 comments on commit 48f7410

Please sign in to comment.