Files
notify-bridge/scripts/restart-backend.sh
T
alexei.dolgolyov d4cb388c74 refactor: unify test dispatch with real NotificationDispatcher
- Route scheduled/memory test sends through the same NotificationDispatcher
  the watcher uses — identical template rendering, media handling, caching
- Add preview_url field to MediaAsset (transcoded mid-size), separate from
  thumbnail_url (small) and full_url (original). Dispatcher prefers preview_url
- Fix sendMediaGroup cache: extract file_ids from Telegram response and store
  via async_set_many so repeat sends use cached file_ids
- Parallelize asset downloads in _send_media_group with asyncio.gather
- Filter unprocessed assets (archived/trashed/offline/no-thumbhash) at album
  parse time in ImmichAlbumData.from_api_response
- Extract shared asset_to_media + collect_scheduled_assets into asset_utils.py
  (single source for test dispatch and future real scheduler)
- Respect tracking config filters: limit, asset_type, favorite_only, min_rating
- Random asset sampling for scheduled sends
- Memory mode: "On This Day" date filter (same month+day, previous year)
- Skip dispatch when no matching assets found
- Remove ~250 lines of duplicated send logic from notifier.py
- Fix restart-backend.sh: proper env var export, Python path resolution, error log
2026-03-24 19:32:40 +03:00

39 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# Restart the backend dev server.
# Usage: bash scripts/restart-backend.sh
cd "$(dirname "$0")/.."
# Kill existing backend
PID=$(netstat -ano 2>/dev/null | grep ':8420.*LISTENING' | awk '{print $5}' | head -1)
if [ -n "$PID" ]; then
taskkill //F //PID "$PID" 2>/dev/null || true
sleep 1
fi
# Resolve python — py launcher needs absolute path for nohup on Windows
if command -v python3 &>/dev/null; then
PYTHON=python3
elif command -v python &>/dev/null; then
PYTHON=python
else
PYTHON=$(py -3.13 -c "import sys; print(sys.executable)" 2>/dev/null \
|| py -3 -c "import sys; print(sys.executable)")
fi
# Start backend
export NOTIFY_BRIDGE_DATA_DIR=./test-data
export NOTIFY_BRIDGE_SECRET_KEY=test-secret-key-minimum-32chars
nohup "$PYTHON" -m uvicorn notify_bridge_server.main:app \
--host 0.0.0.0 --port 8420 > .backend.log 2>&1 &
sleep 3
if curl -sf http://localhost:8420/api/health; then
echo ""
echo "Backend started (PID $!)"
else
echo "Backend failed to start. Log:"
tail -20 .backend.log
exit 1
fi