Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(alert): Refines send recap alerts command #4672

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cl/alerts/management/commands/cl_send_recap_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,19 @@ def index_daily_recap_documents(
:return: The total number of documents re-indexed.
"""

if r.exists("alert_sweep:main_re_index_completed"):
if target_index is RECAPSweepDocument and r.exists(
"alert_sweep:main_re_index_completed"
):
logger.info(
"The main re-index task has been completed and will be omitted."
)
# The main re-indexing has been completed for the day. Abort it and
# proceed with RECAPDocument re-index.
return 0

if r.exists("alert_sweep:rd_re_index_completed"):
if target_index is ESRECAPSweepDocument and r.exists(
"alert_sweep:rd_re_index_completed"
):
logger.info(
"The RECAPDocument only re-index task has been completed and will "
"be omitted."
Expand Down Expand Up @@ -353,7 +357,7 @@ def fields = [
)
task_status = get_task_status(task_id, es)
task_info = retrieve_task_info(task_status)
time.sleep(estimated_time_remaining)
time.sleep(min(estimated_time_remaining, 900))
if task_info and not task_info.completed:
estimated_time_remaining = compute_estimated_remaining_time(
initial_wait, task_info
Expand Down