fix: unbreaks postgrest-profiled-run

* replaces v2-build -> v2-run (which should be v2-exec)
  with one-shot v2-run
* fixes empty postgrest.prof file by sending SIGINT to the profiled
  postgrest process to trigger writing it explicitly
This commit is contained in:
Andrei Dziahel
2025-10-17 15:43:41 -05:00
committed by Steve Chavez
parent c08b87749b
commit b7ad217cd3
2 changed files with 11 additions and 3 deletions
+2 -3
View File
@@ -95,9 +95,8 @@ let
export PGRST_DB_POOL_ACQUISITION_TIMEOUT
export PGRST_JWT_SECRET
${cabal-install}/bin/cabal --builddir="dist-prof" v2-build --enable-profiling --disable-shared exe:postgrest
${cabal-install}/bin/cabal --builddir="dist-prof" v2-run -- \
postgrest +RTS -p -h -RTS "''${_arg_leftovers[@]}"
exec ${cabal-install}/bin/cabal --builddir="dist-prof" v2-run --enable-profiling --disable-shared exe:postgrest -- \
+RTS -p -h -RTS "''${_arg_leftovers[@]}"
'';
repl =
+9
View File
@@ -5,6 +5,7 @@
, lib
, postgresqlVersions
, postgrest
, procps
, python3Packages
, slocat
, writeText
@@ -373,6 +374,14 @@ let
pid=$!
# shellcheck disable=SC2317
cleanup() {
# Send INT to all postgrest processes.
# Workaround to trigger dumping postgrest.prof for postgrest-profiled-run
# Caveat: we cannot realistically limit this to the current process' tree,
# since pkill's --parent supports only direct children; therefore this
# would reap neighbor postgrest instances as well, because INT is asking
# the process to terminate too.
# TODO: consider cgroups to make this cleaner
${procps}/bin/pkill --echo --signal=INT --exact postgrest
kill "$pid" || true
}
trap cleanup EXIT