Skip to content

Commit 075b4ec

Browse files
committed
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
1 parent ec44cbe commit 075b4ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/khoj/database/adapters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ async def aget_user_subscription_state(user: KhojUser) -> str:
333333
Valid state transitions: trial -> subscribed <-> unsubscribed OR expired
334334
"""
335335
user_subscription = await Subscription.objects.filter(user=user).afirst()
336-
return subscription_to_state(user_subscription)
336+
return await sync_to_async(subscription_to_state)(user_subscription)
337337

338338

339339
async def ais_user_subscribed(user: KhojUser) -> bool:

0 commit comments

Comments
 (0)