From 075b4ecf1533907eed31ad22a7d5a9c8ad2f1861 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sat, 2 Nov 2024 12:22:35 -0700 Subject: [PATCH] Call subscription_to_state with sync_to_async wrapper when getting user subscription state - This is needed in case the renewal_date is not set and we need to reset it for the user --- src/khoj/database/adapters/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/database/adapters/__init__.py b/src/khoj/database/adapters/__init__.py index afcaa9f0..7779ad17 100644 --- a/src/khoj/database/adapters/__init__.py +++ b/src/khoj/database/adapters/__init__.py @@ -333,7 +333,7 @@ async def aget_user_subscription_state(user: KhojUser) -> str: Valid state transitions: trial -> subscribed <-> unsubscribed OR expired """ user_subscription = await Subscription.objects.filter(user=user).afirst() - return subscription_to_state(user_subscription) + return await sync_to_async(subscription_to_state)(user_subscription) async def ais_user_subscribed(user: KhojUser) -> bool: