fix(fastapi): use metrics in cases where PROMETHEUS_MULTIPROC_DIR is defined

Previously, we restricted this to gunicorn to get it working on aur-dev.
This change makes it usable through any backend, and also no-op if
PROMETHEUS_MULTIPROC_DIR is not defined.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-11-01 14:18:19 -07:00
parent cdb854259a
commit 9aa8decf40
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 7 additions and 3 deletions

View file

@ -22,6 +22,9 @@ while [ $# -ne 0 ]; do
esac
done
rm -rf $PROMETHEUS_MULTIPROC_DIR
mkdir -p $PROMETHEUS_MULTIPROC_DIR
# Initialize the new database; ignore errors.
python -m aurweb.initdb 2>/dev/null || \
(echo "Error: aurweb.initdb failed; already initialized?" && /bin/true)