Skip to content

Commit

Permalink
it's a trap! (qdrant#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
generall authored and timvisee committed May 25, 2023
1 parent 1ad443d commit 8dd7f61
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tools/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@
# - If it was killed after initialization, do nothing and restart container
# - If recovery mode is not allowed, we just restart container

./qdrant $@
_term () {
kill -TERM "$QDRANT_PID" 2>/dev/null
}

trap _term SIGTERM

_interrupt () {
kill -INT "$QDRANT_PID" 2>/dev/null
}

trap _interrupt SIGINT

./qdrant $@ &

# Get PID for the traps
QDRANT_PID=$!
wait $QDRANT_PID

EXIT_CODE=$?

Expand All @@ -33,7 +49,10 @@ Please check memory consumption, increase memory limit or remove some collection
if [ ! -f "$IS_INITIALIZED_FILE" ]; then
# Run qdrant in recovery mode.
# No collection operations are allowed in recovery mode except for removing collections
QDRANT__STORAGE__RECOVERY_MODE="$RECOVERY_MESSAGE" ./qdrant $@
QDRANT__STORAGE__RECOVERY_MODE="$RECOVERY_MESSAGE" ./qdrant $@ &
# Get PID for the traps
QDRANT_PID=$!
wait $QDRANT_PID
exit $?
fi

Expand Down

0 comments on commit 8dd7f61

Please sign in to comment.