Add time limit option to search-api:index

Created on 18 June 2025, 4 months ago

Problem/Motivation

There is already a --limit option on the search-api:index drush command, but that does not take time into account.

In some scenarios, e.g. a worker running the drush command, having a clean time out would be nice to have, since the limit passed may not always index at the same pace.

Steps to reproduce

N.A.

Proposed resolution

Introduce a new --time-limit option to the command.

Remaining tasks

- Open the MR.
- Code review.

✨ Feature request
Status

Active

Version

1.0

Component

Drush / Rules

Created by

πŸ‡΅πŸ‡ͺPeru marvil07

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @marvil07
  • πŸ‡΅πŸ‡ͺPeru marvil07

    Over MR 244 the new option is introduced.

    From the commit message:

    This time limit is a best effort, not a exact time out.
    Given the underlying code uses Batch API to run the indexing, a more exact bail out is not truly possible.
    Instead, do check after each batch is processed, and act accordingly.

    Sample use:

    drush search-api:index --time-limit=30 node_index
    
  • Pipeline finished with Failed
    4 months ago
    Total: 539s
    #524821
  • Pipeline finished with Success
    4 months ago
    Total: 533s
    #525834
  • Issue was unassigned.
  • Status changed to Needs review about 1 month ago
  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    drunken monkey β†’ made their first commit to this issue’s fork.

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    Looks great, thanks a lot! And sorry for taking so long to reply.
    I just had some minor nitpicks and made some code style changes, otherwise this looks good to go.
    Feel free to review my changes and tell me what you think, otherwise I’ll just merge this in a week or so.

  • πŸ‡΅πŸ‡ͺPeru marvil07

    Looks great, thanks a lot! And sorry for taking so long to reply.

    πŸŽ‰ Thanks for maintaining this project!

    I just had some minor nitpicks and made some code style changes, otherwise this looks good to go.

    Those changes look quite good, thanks!

  • πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

    Found a minor issue when passing a time limit of 0. The code seems to specifically allow for this, but then any time limit of 0 is converted into -1.

  • πŸ‡¦πŸ‡ΉAustria drunken monkey Vienna, Austria

    @kristiaanvandeneynde: Thanks for catching that, you’re right.
    Should be fixed now.

Production build 0.71.5 2024