Skip to content

Commit

Permalink
feat: state how long the reindex_studio command took
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Mar 18, 2024
1 parent 67cf0cc commit c53963e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
indexes LMS (published) courses in ElasticSearch.
"""
import logging
import time

from django.conf import settings
from django.core.management import BaseCommand
Expand Down Expand Up @@ -34,6 +35,7 @@ def handle(self, *args, **options):
"""
Build a new search index for Studio, containing content from courses and libraries
"""
start_time = time.perf_counter()
client = self.get_meilisearch_client()
store = modulestore()

Expand Down Expand Up @@ -111,7 +113,11 @@ def add_with_children(block):
num_contexts_done += 1
num_blocks_done += len(docs)

self.stdout.write(f"Done! {num_blocks_done} blocks indexed across {num_contexts_done} courses and libraries.")
elapsed_time = time.perf_counter() - start_time
self.stdout.write(
f"Done! {num_blocks_done} blocks indexed across {num_contexts_done} courses "
f"and libraries in {elapsed_time:.0f}s."
)

def recurse_children(self, block, fn):
"""
Expand Down

0 comments on commit c53963e

Please sign in to comment.