-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: change default thumbnail concurrency and auto-detect container…
… core count (#9981) * feat: automatically detect amount of CPU cores and allow overriding with CPU_CORES env var * chore: change default thumbnail concurrency to 3
- Loading branch information
1 parent
b2761b1
commit abf6fc2
Showing
8 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
design/ | ||
docker/ | ||
!docker/scripts | ||
docs/ | ||
e2e/ | ||
fastlane/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
LOG_LEVEL="${IMMICH_LOG_LEVEL:='info'}" | ||
|
||
logDebug() { | ||
if [ "$LOG_LEVEL" = "debug" ] || [ "$LOG_LEVEL" = "verbose" ]; then | ||
echo "DEBUG: $1" >&2 | ||
fi | ||
} | ||
|
||
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then | ||
logDebug "cgroup v2 detected." | ||
if [ -f /sys/fs/cgroup/cpu.max ]; then | ||
read -r quota period </sys/fs/cgroup/cpu.max | ||
if [ "$quota" = "max" ]; then | ||
logDebug "No CPU limits set." | ||
unset quota period | ||
fi | ||
else | ||
logDebug "/sys/fs/cgroup/cpu.max not found." | ||
fi | ||
else | ||
logDebug "cgroup v1 detected." | ||
|
||
if [ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us ] && [ -f /sys/fs/cgroup/cpu/cpu.cfs_period_us ]; then | ||
quota=$(cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us) | ||
period=$(cat /sys/fs/cgroup/cpu/cpu.cfs_period_us) | ||
|
||
if [ "$quota" = "-1" ]; then | ||
logDebug "No CPU limits set." | ||
unset quota period | ||
fi | ||
else | ||
logDebug "/sys/fs/cgroup/cpu/cpu.cfs_quota_us or /sys/fs/cgroup/cpu/cpu.cfs_period_us not found." | ||
fi | ||
fi | ||
|
||
if [ -n "${quota:-}" ] && [ -n "${period:-}" ]; then | ||
cpus=$((quota / period)) | ||
if [ "$cpus" -eq 0 ]; then | ||
cpus=1 | ||
fi | ||
else | ||
cpus=$(grep -c processor /proc/cpuinfo) | ||
fi | ||
|
||
echo "$cpus" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters