Skip to content

Commit

Permalink
fix: perf diff
Browse files Browse the repository at this point in the history
  • Loading branch information
elrrrrrrr committed Jun 13, 2024
1 parent 038736d commit a5c8b2e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/core/service/BinarySyncerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export class BinarySyncerService extends AbstractService {
existsMap.set(item.name, item);
}
const diffItems: { item: Binary; reason: string }[] = [];
let latestItem: BinaryItem | undefined;
for (const item of fetchItems) {
const existsItem = existsMap.get(item.name);
if (!existsItem) {
Expand All @@ -276,7 +277,10 @@ export class BinarySyncerService extends AbstractService {
existsItem.ignoreDownloadStatuses = item.ignoreDownloadStatuses;
existsItem.date = item.date;
} else if (dir.endsWith(latestVersionParent)) {
const isLatestItem = sortBy(fetchItems, [ 'date' ]).pop()?.name === item.name;
if (!latestItem) {
latestItem = sortBy(fetchItems, [ 'date' ]).pop();
}
const isLatestItem = latestItem?.name === item.name;
if (isLatestItem && existsItem.isDir) {
diffItems.push({
item: existsItem,
Expand Down

0 comments on commit a5c8b2e

Please sign in to comment.