Skip to content

Commit

Permalink
fix: pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Mar 19, 2024
1 parent 232cb71 commit 10336c1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions openedx/core/djangoapps/content/search/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,15 @@ def _index_rebuild_lock(index_name: str) -> Generator[str, None, None]:
try:
yield new_index_name
finally:
break
# Release the lock
cache.delete(lock_id)
return

if time.monotonic() > timeout_at:
raise TimeoutError("Timeout acquiring lock")

time.sleep(1)

# Release the lock
cache.delete(lock_id)


def _get_running_rebuild_index_name(index_name: str) -> str | None:
lock_id = f"lock-meilisearch-index-{index_name}"
Expand Down Expand Up @@ -181,7 +180,6 @@ def nop(_):
time.sleep(1)
if client.get_index(target_index).created_at != new_index_created:
status_cb("Waiting for swap completion...")
pass
else:
break
status_cb("Deleting old index...")
Expand All @@ -203,7 +201,6 @@ def _recurse_children(block, fn, status_cb: Callable[[str], None] | None = None)
log.exception(err)
if status_cb is not None:
status_cb(f"Unable to load block {child_id}")
pass
else:
fn(child)

Expand Down Expand Up @@ -340,7 +337,9 @@ def delete_xblock_index_doc(usage_key: UsageKey) -> None:
# FixMe: Create function to wait for multiple tasks to run this in parallel
if current_rebuild_index_name:
# Updates the new index
_wait_for_meili_task(client.index(current_rebuild_index_name).delete_document(meili_id_from_opaque_key(usage_key)))
_wait_for_meili_task(client.index(current_rebuild_index_name).delete_document(
meili_id_from_opaque_key(usage_key)
))

_wait_for_meili_task(client.index(INDEX_NAME).delete_document(meili_id_from_opaque_key(usage_key)))

Expand Down

0 comments on commit 10336c1

Please sign in to comment.