mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 22:20:12 +00:00
Logging failed page fetch timeout.
This commit is contained in:
parent
e9fdaadc70
commit
006bdc7964
5 changed files with 40 additions and 21 deletions
2
Makefile
2
Makefile
|
@ -185,7 +185,7 @@ maintenance_off:
|
||||||
|
|
||||||
# Provision
|
# Provision
|
||||||
firewall:
|
firewall:
|
||||||
ansible-playbook ansible/all.yml -l db --tags firewall
|
ansible-playbook ansible/all.yml -l db --tags ufw
|
||||||
oldfirewall:
|
oldfirewall:
|
||||||
ANSIBLE_CONFIG=/srv/newsblur/ansible.old.cfg ansible-playbook ansible/all.yml -l db --tags firewall
|
ANSIBLE_CONFIG=/srv/newsblur/ansible.old.cfg ansible-playbook ansible/all.yml -l db --tags firewall
|
||||||
repairmongo:
|
repairmongo:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
- name: SETUP -> node containers
|
- name: SETUP -> node containers
|
||||||
hosts: node
|
hosts: node
|
||||||
become: true
|
|
||||||
vars_files:
|
vars_files:
|
||||||
- ../env_vars/base.yml
|
- ../env_vars/base.yml
|
||||||
vars:
|
vars:
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
tags: packages
|
tags: packages
|
||||||
# ignore_errors: yes
|
# ignore_errors: yes
|
||||||
|
|
||||||
|
- name: whoami
|
||||||
|
debug:
|
||||||
|
var: ansible_user_id
|
||||||
|
tags: whoami
|
||||||
|
|
||||||
- name: Set timezone
|
- name: Set timezone
|
||||||
become: yes
|
become: yes
|
||||||
|
@ -27,10 +31,20 @@
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: Cloning oh-my-zsh
|
- name: Cloning oh-my-zsh
|
||||||
git:
|
block:
|
||||||
repo: https://github.com/robbyrussell/oh-my-zsh
|
- name: Cloning oh-my-zsh
|
||||||
dest: /home/nb/.oh-my-zsh
|
git:
|
||||||
force: yes
|
repo: https://github.com/robbyrussell/oh-my-zsh
|
||||||
|
dest: /home/nb/.oh-my-zsh
|
||||||
|
force: yes
|
||||||
|
rescue:
|
||||||
|
- name: chown oh-my-zsh
|
||||||
|
become: yes
|
||||||
|
file:
|
||||||
|
path: /home/nb/.oh-my-zsh
|
||||||
|
owner: nb
|
||||||
|
group: nb
|
||||||
|
recurse: yes
|
||||||
|
|
||||||
- name: Copy toprc
|
- name: Copy toprc
|
||||||
copy: src=toprc.txt dest=~/.toprc
|
copy: src=toprc.txt dest=~/.toprc
|
||||||
|
|
|
@ -1,23 +1,28 @@
|
||||||
import requests
|
|
||||||
import re
|
|
||||||
import traceback
|
|
||||||
import feedparser
|
|
||||||
import time
|
|
||||||
import urllib.request, urllib.error, urllib.parse
|
|
||||||
import http.client
|
import http.client
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.request
|
||||||
import zlib
|
import zlib
|
||||||
|
from socket import error as SocketError
|
||||||
|
|
||||||
|
import feedparser
|
||||||
|
import requests
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.utils.encoding import smart_bytes
|
from django.utils.encoding import smart_bytes
|
||||||
from mongoengine.queryset import NotUniqueError
|
|
||||||
from socket import error as SocketError
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.text import compress_string as compress_string_with_gzip
|
from django.utils.text import compress_string as compress_string_with_gzip
|
||||||
from utils import log as logging
|
from mongoengine.queryset import NotUniqueError
|
||||||
from apps.rss_feeds.models import MFeedPage
|
|
||||||
from utils.feed_functions import timelimit, TimeoutError
|
|
||||||
from OpenSSL.SSL import Error as OpenSSLError
|
from OpenSSL.SSL import Error as OpenSSLError
|
||||||
from pyasn1.error import PyAsn1Error
|
from pyasn1.error import PyAsn1Error
|
||||||
from sentry_sdk import capture_exception, flush
|
from sentry_sdk import capture_exception, flush
|
||||||
|
|
||||||
|
from apps.rss_feeds.models import MFeedPage
|
||||||
|
from utils import log as logging
|
||||||
|
from utils.feed_functions import TimeoutError, timelimit
|
||||||
|
|
||||||
# from utils.feed_functions import mail_feed_error_to_admin
|
# from utils.feed_functions import mail_feed_error_to_admin
|
||||||
|
|
||||||
BROKEN_PAGES = [
|
BROKEN_PAGES = [
|
||||||
|
@ -127,6 +132,7 @@ class PageImporter(object):
|
||||||
return
|
return
|
||||||
except (ValueError, urllib.error.URLError, http.client.BadStatusLine, http.client.InvalidURL,
|
except (ValueError, urllib.error.URLError, http.client.BadStatusLine, http.client.InvalidURL,
|
||||||
requests.exceptions.ConnectionError) as e:
|
requests.exceptions.ConnectionError) as e:
|
||||||
|
logging.debug(' ***> [%-30s] Page fetch failed: %s' % (self.feed.log_title[:30], e))
|
||||||
self.feed.save_page_history(401, "Bad URL", e)
|
self.feed.save_page_history(401, "Bad URL", e)
|
||||||
try:
|
try:
|
||||||
fp = feedparser.parse(self.feed.feed_address)
|
fp = feedparser.parse(self.feed.feed_address)
|
||||||
|
@ -134,10 +140,8 @@ class PageImporter(object):
|
||||||
return html
|
return html
|
||||||
feed_link = fp.feed.get('link', "")
|
feed_link = fp.feed.get('link', "")
|
||||||
self.feed.save()
|
self.feed.save()
|
||||||
logging.debug(' ***> [%-30s] Page fetch failed: %s' % (self.feed.log_title[:30], e))
|
|
||||||
except (urllib.error.HTTPError) as e:
|
|
||||||
self.feed.save_page_history(e.code, e.msg, e.fp.read())
|
|
||||||
except (http.client.IncompleteRead) as e:
|
except (http.client.IncompleteRead) as e:
|
||||||
|
logging.debug(' ***> [%-30s] Page fetch failed: %s' % (self.feed.log_title[:30], e))
|
||||||
self.feed.save_page_history(500, "IncompleteRead", e)
|
self.feed.save_page_history(500, "IncompleteRead", e)
|
||||||
except (requests.exceptions.RequestException,
|
except (requests.exceptions.RequestException,
|
||||||
requests.packages.urllib3.exceptions.HTTPError) as e:
|
requests.packages.urllib3.exceptions.HTTPError) as e:
|
||||||
|
|
|
@ -46,3 +46,5 @@ ansible-playbook ansible/deploy.yml -l happ-web-01 --tags maintenance_off
|
||||||
aps -l www -t haproxy
|
aps -l www -t haproxy
|
||||||
# Change DNS to point to Hetzner
|
# Change DNS to point to Hetzner
|
||||||
make maintenance_off
|
make maintenance_off
|
||||||
|
|
||||||
|
# Setup redis replicas (replica.conf port)
|
||||||
|
|
Loading…
Add table
Reference in a new issue