Fix the cache loading for static content
This commit is contained in:
parent
71dc20ae4d
commit
fd8514b207
@ -15,10 +15,14 @@ class ContentService:
|
|||||||
async def retrieve_content_directories_for_folder(
|
async def retrieve_content_directories_for_folder(
|
||||||
self, folder_name: str, region: UserRegion
|
self, folder_name: str, region: UserRegion
|
||||||
) -> List[ContentDirectory]:
|
) -> List[ContentDirectory]:
|
||||||
folder = await ContentFolderDoc.find_one(
|
folder = (
|
||||||
|
await ContentFolderDoc.find(
|
||||||
ContentFolderDoc.folder_name == folder_name,
|
ContentFolderDoc.folder_name == folder_name,
|
||||||
ContentFolderDoc.region == region,
|
ContentFolderDoc.region == region,
|
||||||
)
|
)
|
||||||
|
.sort(-ContentFolderDoc.udpate_time)
|
||||||
|
.first_or_none()
|
||||||
|
)
|
||||||
if folder is None or folder.valid_thru.replace(
|
if folder is None or folder.valid_thru.replace(
|
||||||
tzinfo=timezone.utc
|
tzinfo=timezone.utc
|
||||||
) < datetime.now(timezone.utc):
|
) < datetime.now(timezone.utc):
|
||||||
|
|||||||
@ -27,3 +27,7 @@ class ContentFolderDoc(Document):
|
|||||||
|
|
||||||
class Settings:
|
class Settings:
|
||||||
name = "content_folder"
|
name = "content_folder"
|
||||||
|
indexes = [
|
||||||
|
[("folder_name", 1), ("region", 1)], # Compound index
|
||||||
|
[("udpate_time", -1)], # Descending index for udpate_time
|
||||||
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user