Browse Source

some exception handling and updated service files

master
René Wagner 5 months ago
parent
commit
e0fba80405
  1. 2
      gus/constants.py
  2. 6
      gus/crawl.py
  3. 10
      infra/gus.service
  4. 1
      infra/update_index.sh

2
gus/constants.py

@ -6,7 +6,7 @@ DB_FILENAME = "gus.sqlite"
FEED_FILE = "feeds.txt"
MAXIMUM_REDIRECT_CHAIN_LENGTH = 5
MAXIMUM_FAILED_REQUEST_COUNT = 5
MAXIMUM_TEXT_PAGE_SIZE = 100000 # 100KB, in bytes
MAXIMUM_TEXT_PAGE_SIZE = 1000000 # 1000KB, in bytes
# default change frequencies (in hours)
ROOT_CHANGE_FREQUENCY_DEFAULT = 12

6
gus/crawl.py

@ -440,7 +440,11 @@ def should_skip(resource):
def index_links(from_resource, contained_resources):
from_page, created = Page.get_or_create(url=from_resource.indexable_url)
Link.delete().where(Link.from_page == from_page).execute()
try:
Link.delete().where(Link.from_page == from_page).execute()
except:
logging.error("Error deleting link: %s", gus.lib.logging.strip_control_chars(Link.from_page))
data = []
for cr in contained_resources:
if should_skip(cr):

10
infra/gus.service

@ -9,14 +9,14 @@ Group=gus
Type=simple
Restart=always
RestartSec=5
WorkingDirectory=/home/gus/code/gus
WorkingDirectory=/home/gus/
Environment="PYTHONUNBUFFERED=1"
ExecStart=/home/gus/.poetry/bin/poetry run serve \
--host "::" \
--port 1965 \
--hostname gus.guru \
--tls-certfile certs/cert.pem \
--tls-keyfile certs/key.pem
--host "::" \
--hostname geminispace.info \
--tls-certfile geminispace.info.crt \
--tls-keyfile geminispace.info.key
[Install]
WantedBy=default.target

1
infra/update_index.sh

@ -4,4 +4,3 @@ rm -rf /home/gus/index.old
rm -rf /home/gus/index.new/MAIN.tmp/
mv /home/gus/index /home/gus/index.old
mv /home/gus/index.new /home/gus/index
sudo systemctl restart gus

Loading…
Cancel
Save