Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion opbeans/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .celery import app as celery_app
default_app_config = 'opbeans.apps.OpbeansAppConfig'
5 changes: 2 additions & 3 deletions opbeans/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True


Expand Down Expand Up @@ -205,6 +203,7 @@
}

structlog_processors=[
structlog.contextvars.merge_contextvars,
structlog.stdlib.filter_by_level,
structlog.processors.TimeStamper(fmt="iso", key="@timestamp"),
structlog.stdlib.add_logger_name,
Expand All @@ -227,7 +226,7 @@

structlog.configure(
processors=structlog_processors,
context_class=structlog.threadlocal.wrap_dict(dict),
context_class=dict,
logger_factory=structlog.stdlib.LoggerFactory(),
wrapper_class=structlog.stdlib.BoundLogger,
cache_logger_on_first_use=True,
Expand Down
7 changes: 3 additions & 4 deletions opbeans/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.db import models as m

import elasticapm
from elasticsearch import TransportError
from elasticsearch import NotFoundError
from elasticsearch.helpers import bulk
from elasticsearch_dsl import Search
from elasticsearch_dsl.connections import connections
Expand Down Expand Up @@ -36,9 +36,8 @@ def sync_orders():
try:
r = Search(index='py-orders').sort('-_id')[0].execute()
highest_id = int(r.hits[0].meta.id)
except TransportError as e:
if e.status_code == 404:
highest_id = 0
except NotFoundError:
highest_id = 0
order_docs = []
for order in models.Order.objects.filter(id__gt=highest_id).prefetch_related('customer'):
order_docs.append(documents.Order(**order.to_search()).to_dict(include_meta=True))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ elasticsearch==8.17.2
elasticsearch-dsl==8.17.1
elastic-transport==8.17.1
gunicorn==23.0.0
honcho==1.1.0
honcho==2.0.0
kombu==5.5.2
psycopg2-binary==2.9.10
pytz
Expand Down