fix: address PR review — move memory limits to deploy block, handle swap-less hosts
All checks were successful
Auto-merge docs-only PRs / auto-merge-docs (pull_request) Successful in 2s

Move mem_limit/memswap_limit to deploy.resources.limits.memory so the
constraint is actually enforced under Compose v3. Add END clause to
swap_mb() so hosts without a Swap line report 0 instead of empty output.
Fix test script header comment accuracy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-04-02 21:05:12 -05:00
parent f28dfeb4bf
commit e58c5b8cc1
3 changed files with 5 additions and 6 deletions

View File

@ -90,7 +90,7 @@ zombie_parents() {
}
swap_mb() {
free | awk '\''/^Swap:/ {printf "%.0f", $3/1024}'\''
free | awk '\''/^Swap:/ {printf "%.0f", $3/1024; found=1} END {if (!found) print "0"}'\''
}
oom_events() {

View File

@ -1,9 +1,8 @@
#!/usr/bin/env bash
# test-audit-collectors.sh — validates homelab-audit.sh collector output format
#
# Extracts each collector function from the audit script's COLLECTOR_SCRIPT
# heredoc and runs it locally, checking that output matches the expected
# key=value format. Exits non-zero on first failure.
# Re-implements each collector function inline and runs it locally, checking
# that output matches the expected format. Exits non-zero on any failure.
set -euo pipefail

View File

@ -26,8 +26,6 @@ services:
container_name: tdarr-node
init: true
restart: unless-stopped
mem_limit: 28g
memswap_limit: 30g
environment:
- PUID=1000
- PGID=1000
@ -41,6 +39,8 @@ services:
- /mnt/NV2/tdarr-cache:/temp
deploy:
resources:
limits:
memory: 28g
reservations:
devices:
- driver: nvidia