Browse Source

Fix bug in event ingest auth
Always parse stripe metadata as string

David Burke 5 months ago
parent
commit
59f67c44e8

+ 16 - 0
apps/djstripe_ext/migrations/0002_delete_subscriptionquotawarning.py

@@ -0,0 +1,16 @@
+# Generated by Django 5.1.2 on 2024-10-12 19:00
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djstripe_ext', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.DeleteModel(
+            name='SubscriptionQuotaWarning',
+        ),
+    ]

+ 1 - 1
apps/event_ingest/authentication.py

@@ -94,7 +94,7 @@ async def get_project(request: HttpRequest) -> Project | None:
     # block cache check should be right before database call
     block_cache_key = EVENT_BLOCK_CACHE_KEY + str(project_id)
     if block_value := cache.get(block_cache_key):
-        if block_value.startwith("t"):
+        if block_value.startswith("t"):
             if throttle := deserialize_throttle(block_value):
                 org_throttle, project_throttle = throttle
                 if not is_accepting_events(org_throttle) or not is_accepting_events(

+ 2 - 0
apps/organizations_ext/tasks.py

@@ -52,6 +52,8 @@ def _check_and_update_throttle(org: Organization):
         .values_list("metadata__events", flat=True)
         .first()
     )
+    if plan_events:
+        plan_events = int(plan_events)
     org_throttle = 0
     if plan_events is None or org.total_event_count > plan_events * 2:
         org_throttle = 100