Skip to content

Commit cb9607a

Browse files
authored
Improve speed in versions check and "-f" (#1959)
Doubled speed (on AMD Ryzen 5)
1 parent d922174 commit cb9607a

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

APP-MANAGER

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
AMVERSION="9.9.1-1"
3+
AMVERSION="9.9.1-2"
44

55
# Determine main repository and branch
66
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
@@ -783,6 +783,7 @@ _check_version() {
783783
rm -f "$AMCACHEDIR"/version-args
784784
_determine_args
785785
for arg in $ARGS; do
786+
(
786787
argpath=$(echo "$ARGPATHS" | grep "/$arg$")
787788
if [ -f "$argpath"/remove ]; then
788789
if [ -f "$argpath"/version ]; then
@@ -803,7 +804,9 @@ _check_version() {
803804
fi
804805
echo "$arg | $APPVERSION" >> "$AMCACHEDIR"/version-args
805806
fi
807+
) &
806808
done
809+
wait
807810
}
808811

809812
_check_version_for_auto_updatable_apps() {

modules/database.am

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,21 +322,24 @@ _files_db() {
322322
echo "$arg | $DB" >> "$AMCACHEDIR"/files-db
323323
}
324324

325-
_files_files() {
326-
_check_version
327-
rm -f "$AMCACHEDIR"/files-*
328-
for arg in $INSTALLED_APPS; do
329-
[ -f ./"$arg"/remove ] && _files_db && _files_sizes && _files_type
330-
done
331-
}
332-
333325
# CREATE THE TABLE
334326
_files() {
335327
cd "$APPSPATH" || exit 1
336328
INSTALLED_APPS_BY_SIZE=$(du -sh $INSTALLED_APPS_PATHS 2>/dev/null | sort -rh)
337329
INSTALLED_APPS=$(echo "$INSTALLED_APPS_BY_SIZE" | grep "$APPSPATH" | sed 's:.*/::' | xargs)
338330

339-
_files_files
331+
_check_version
332+
rm -f "$AMCACHEDIR"/files-*
333+
for arg in $INSTALLED_APPS; do
334+
if [ -f ./"$arg"/remove ]; then
335+
(
336+
_files_db
337+
_files_sizes
338+
_files_type
339+
) &
340+
fi
341+
done
342+
wait
340343
rm -f "$AMCACHEDIR"/files-args
341344
for arg in $INSTALLED_APPS; do
342345
if test -f ./"$arg"/remove 2>/dev/null; then

0 commit comments

Comments
 (0)