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 35ed350
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();
}
let isLatestItem = latestItem?.name === item.name;

Check failure on line 283 in app/core/service/BinarySyncerService.ts

View workflow job for this annotation

GitHub Actions / test-mysql57-fs-nfs (18, ubuntu-latest)

'isLatestItem' is never reassigned. Use 'const' instead

Check failure on line 283 in app/core/service/BinarySyncerService.ts

View workflow job for this annotation

GitHub Actions / test-mysql57-fs-nfs (20, ubuntu-latest)

'isLatestItem' is never reassigned. Use 'const' instead

Check failure on line 283 in app/core/service/BinarySyncerService.ts

View workflow job for this annotation

GitHub Actions / test-mysql57-fs-nfs (22, ubuntu-latest)

'isLatestItem' is never reassigned. Use 'const' instead
if (isLatestItem && existsItem.isDir) {
diffItems.push({
item: existsItem,
Expand Down

0 comments on commit 35ed350

Please sign in to comment.