docs: complete video cleanup rollout

This commit is contained in:
Dmitriy Belyaev 2026-06-27 14:11:59 +03:00
parent d00ff63897
commit b792d09b0d

View file

@ -15,11 +15,11 @@
**Files:**
- Modify: `app/worker.py`
- [ ] **Step 1: Import directory removal support**
- [x] **Step 1: Import directory removal support**
Add `import shutil` alongside the existing standard-library imports.
- [ ] **Step 2: Add the cleanup helper**
- [x] **Step 2: Add the cleanup helper**
Implement a helper with this contract:
@ -37,11 +37,11 @@ def cleanup_uploaded_video_artifacts(video: Video) -> None:
video.local_cover_path = None
```
- [ ] **Step 3: Invoke cleanup after successful upload**
- [x] **Step 3: Invoke cleanup after successful upload**
After assigning `video.ok_video_id` and setting `video.status = "ok_uploaded"`, call the helper inside a `try/except OSError` block. Log failures and retain the successful upload status.
- [ ] **Step 4: Compile the worker**
- [x] **Step 4: Compile the worker**
Run: `python3 -m compileall app/worker.py`
@ -52,14 +52,14 @@ Expected: `Compiling 'app/worker.py'...` with exit code 0.
**Files:**
- Deploy: `app/worker.py` to `/var/www/bots/vk2ok/app/worker.py`
- [ ] **Step 1: Rebuild services**
- [x] **Step 1: Rebuild services**
Run `docker compose up -d --build api worker beat` in `/var/www/bots/vk2ok`.
- [ ] **Step 2: Clean existing uploaded artifacts**
- [x] **Step 2: Clean existing uploaded artifacts**
Inside the API container, query `Video` rows where `ok_video_id IS NOT NULL` and either local path is set. Apply `cleanup_uploaded_video_artifacts` and commit each successful cleanup.
- [ ] **Step 3: Verify health and storage state**
- [x] **Step 3: Verify health and storage state**
Confirm all containers are running, Celery recovery returns normally, uploaded rows have null local paths, and no open publication work remains.