fix: reset stale remote agent updates after sac-api restart (0.4.3)
Clear zombie running jobs on deploy and add admin API to cancel a stuck job. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -105,6 +105,25 @@ print('db: OK')
|
||||
" || die "PostgreSQL: проверьте DATABASE_URL в ${CONFIG_FILE} и systemctl status postgresql"
|
||||
|
||||
log "systemctl restart ${SERVICE_NAME} (краткий 502 в UI возможен ~10 с)"
|
||||
log "Сброс зависших remote_action (running без worker после restart)"
|
||||
sudo -u "${APP_USER}" bash -c "
|
||||
set -a
|
||||
# shellcheck source=/dev/null
|
||||
source '${CONFIG_FILE}'
|
||||
set +a
|
||||
cd '${APP_ROOT}/backend'
|
||||
'${VENV}/bin/python' -c \"
|
||||
from app.database import SessionLocal
|
||||
from app.services.host_remote_actions import clear_stale_running_remote_actions
|
||||
session = SessionLocal()
|
||||
try:
|
||||
names = clear_stale_running_remote_actions(session)
|
||||
for name in names:
|
||||
print(f'stale remote_action reset: {name}')
|
||||
finally:
|
||||
session.close()
|
||||
\"
|
||||
"
|
||||
systemctl restart "${SERVICE_NAME}"
|
||||
systemctl is-active --quiet "${SERVICE_NAME}" || die "${SERVICE_NAME} не active"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user