Skip to content

cron: Active streams cleanup #7043

cron: Active streams cleanup

cron: Active streams cleanup #7043

name: "cron: Active streams cleanup"
on:
schedule:
- cron: "*/5 * * * *" # run every 5 minutes
jobs:
cleanup:
strategy:
fail-fast: false
matrix:
env:
- name: "staging"
hostname: "livepeer.monster"
api-token-secret: LP_STAGING_API_ADMIN_TOKEN
- name: production
hostname: "livepeer.studio"
api-token-secret: LP_API_ADMIN_TOKEN
runs-on: ubuntu-latest
steps:
- name: Clean-up ${{ matrix.env.name }} active streams
run: |
output_file="./cleaned-up-streams-${{ matrix.env.name }}.json"
api_token="${{ secrets[matrix.env.api-token-secret] }}"
curl --fail --request POST \
--url 'https://${{ matrix.env.hostname }}/api/stream/job/active-cleanup' \
--header "Authorization: Bearer $api_token" \
-o $output_file
cleaned_count=$(jq '.cleanedUp | length' $output_file)
echo "Cleaned up $cleaned_count streams in ${{ matrix.env.name }}"
- name: Upload cleaned up streams file
uses: actions/upload-artifact@v4
with:
name: cleaned-up-streams-${{ matrix.env.name }}.json
path: cleaned-up-streams-${{ matrix.env.name }}.json
retention-days: 30