Skip to content

Commit

Permalink
Fix firestore IN query limits (#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin authored Feb 3, 2025
2 parents 06e98f6 + dca8709 commit f364d54
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/utils/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,11 @@ def paid_app(app_id: str, uid: str):

def is_audio_bytes_app_enabled(uid: str):
enabled_apps = get_enabled_plugins(uid)
audio_apps_count = get_audio_apps_count(enabled_apps)
return audio_apps_count > 0
# https://firebase.google.com/docs/firestore/query-data/queries#in_and_array-contains-any
limit = 30
enabled_apps = list(set(enabled_apps))
for i in range(0, len(enabled_apps), limit):
audio_apps_count = get_audio_apps_count(enabled_apps[i:i+limit])
if audio_apps_count > 0:
return True
return False

0 comments on commit f364d54

Please sign in to comment.