Fix price extraction bug and remove debugging statements
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from datetime import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from elastic_transport import ConnectionError
|
||||
from elasticsearch import Elasticsearch
|
||||
|
||||
from core.util import logs
|
||||
@@ -27,6 +28,10 @@ def store_msg(index, msg):
|
||||
client = initialise_elasticsearch()
|
||||
if "ts" not in msg:
|
||||
msg["ts"] = datetime.utcnow().isoformat()
|
||||
result = client.index(index=index, body=msg)
|
||||
try:
|
||||
result = client.index(index=index, body=msg)
|
||||
except ConnectionError as e:
|
||||
log.error(f"Error indexing '{msg}': {e}")
|
||||
return
|
||||
if not result["result"] == "created":
|
||||
log.error(f"Indexing of '{msg}' failed: {result}")
|
||||
|
||||
Reference in New Issue
Block a user