Fix price extraction bug and remove debugging statements

This commit is contained in:
2023-08-26 11:05:28 +00:00
parent cd32dff779
commit e10c6f5c46
6 changed files with 10 additions and 25 deletions

View File

@@ -67,6 +67,7 @@ def update_customer_fields(user):
name = expand_name(user.first_name, user.last_name)
stripe.Customer.modify(user.stripe_id, name=name)
def create_or_update_customer(user):
"""
Create or update a customer in Lago.

View File

@@ -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}")