mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-11 13:08:34 +03:00
detecting already inserted entries
This commit is contained in:
@@ -25,7 +25,7 @@ load_dotenv()
|
||||
|
||||
# Configuration
|
||||
ALLOWED_ORIGINS = os.environ.get("ALLOWED_ORIGINS", "chrome-extension://ondkcheoicfckabcnkdgbepofpjmjcmb,chrome-extension://ojcimmjndnlmmlgnjaeojoebaceokpdp").split(",")
|
||||
VERSION = "0.5.11"
|
||||
VERSION = "0.5.12"
|
||||
|
||||
# min-version refers to the version of auto-archiver-extension on the webstore
|
||||
BREAKING_CHANGES = {"minVersion": "0.3.1", "message": "The latest update has breaking changes, please update the extension to the most recent version."}
|
||||
|
||||
@@ -13,7 +13,7 @@ from db.database import SessionLocal
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
|
||||
from sqlite3 import IntegrityError
|
||||
from sqlalchemy import exc
|
||||
|
||||
celery = Celery(__name__)
|
||||
celery.conf.broker_url = os.environ.get("CELERY_BROKER_URL", "redis://localhost:6379")
|
||||
@@ -77,13 +77,11 @@ def create_sheet_task(self, sheet_json: str):
|
||||
try:
|
||||
insert_result_into_db(result, sheet.tags, sheet.public, sheet.group_id, sheet.author_id, models.generate_uuid())
|
||||
stats["archived"] += 1
|
||||
except IntegrityError as e:
|
||||
# cache was used, so we skip
|
||||
except exc.IntegrityError as e:
|
||||
logger.warning(f"cached result detected: {e}")
|
||||
logger.warning(traceback.format_exc())
|
||||
stats["archived"] += 1
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.error(type(e))
|
||||
logger.error(e)
|
||||
logger.error(traceback.format_exc())
|
||||
stats["failed"] += 1
|
||||
|
||||
Reference in New Issue
Block a user