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

[RFC] Make troubleshooting stuck tasks easier #706

Open
greg0ire opened this issue May 11, 2022 · 0 comments
Open

[RFC] Make troubleshooting stuck tasks easier #706

greg0ire opened this issue May 11, 2022 · 0 comments

Comments

@greg0ire
Copy link

Hi! I'm working with @julienpa to get the applications of my company on a new Algolia architecture, and I'm facing issues where some of the cronjobs I have to run appear to be stuck sometimes.

I'd like to be able to easily implement custom logic where I start logging the taskID with an increasingly high log level when exceeded an arbitrary duration, and I would like that logic to kick in whenever I call wait() on a response.

This seems to result in this method being called:

public function waitTask($taskId, $requestOptions = [])
{
$retry = 1;
$time = $this->config->getWaitTaskTimeBeforeRetry();
do {
$res = $this->getTask($taskId, $requestOptions);
if ('published' === $res['status']) {
return;
}
$retry++;
$factor = ceil($retry / 10);
usleep($factor * $time); // 0.1 second
} while (true);
}

It would be great if the current implementation of the retry logic could be extracted in a separate class, and if there was an interface I could implement with my custom logic and if I was able to inject my custom implementation in the configuration so that it replaces the default implementation.

Right now, the workaround would be to extend the SearchIndex, override that method, extend SearchClient and override initIndex so that it returns the overridden SearchIndex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant