Compare commits
2 Commits
4eecfc4aff
...
1dcd80a8bb
| Author | SHA1 | Date | |
|---|---|---|---|
| 1dcd80a8bb | |||
| c15e9bbd7c |
@@ -7,7 +7,31 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- name: Create and activate virtual environment
|
||||||
|
run: |
|
||||||
|
python -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install pytest
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
source venv/bin/activate
|
||||||
|
pytest --maxfail=1 --disable-warnings -q
|
||||||
|
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -539,17 +539,11 @@ def delete_old_messages(minutes: int = 6) -> None:
|
|||||||
headers, DISCORD_CHANNEL_ID, webhook_id, author_id, cutoff, last_message_id
|
headers, DISCORD_CHANNEL_ID, webhook_id, author_id, cutoff, last_message_id
|
||||||
)
|
)
|
||||||
|
|
||||||
# Exit loop if no more messages to delete
|
# Stop scanning when a page has no eligible messages to delete.
|
||||||
|
# Continuing pagination here can walk indefinitely through history.
|
||||||
if not delete_list:
|
if not delete_list:
|
||||||
if deleted_count == 0:
|
if deleted_count == 0:
|
||||||
if next_last_message_id is None or next_last_message_id == last_message_id:
|
logging.info("No messages to delete.")
|
||||||
logging.info("No messages to delete.")
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
logging.info(
|
|
||||||
"No messages deleted in this batch, but more messages may exist... Continuing pagination.")
|
|
||||||
last_message_id = next_last_message_id
|
|
||||||
continue
|
|
||||||
else:
|
else:
|
||||||
logging.info("No more messages to delete.")
|
logging.info("No more messages to delete.")
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user