ILIAS icon indicating copy to clipboard operation
ILIAS copied to clipboard

Background Tasks: Async background tasks fail silently if soap client return false

Open fneumann opened this issue 1 year ago • 2 comments

See https://mantis.ilias.de/view.php?id=42183

This PR ads a fallback to SyncTaskManager if the soap client returns false.

fneumann avatar Sep 30 '24 10:09 fneumann

One thing that I discovered in projects with time consumer async. background tasks.

  1. It could be worth setting a response timeout of 0 by calling $soap_client->setResponseTimeout(0); (in \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager::run).
  2. A ignore_user_abort(true); could be set in \ilSoapBackgroundTasksAdministration::runAsync

As far as I can see, the SOAP call is "Fire & Forget" anyway.

This approach will ensure some of the false or Exception cases will not occur anymore and the client/caller (ILIAS itself) does not unnecessarily wait.

mjansenDatabay avatar Oct 02 '24 11:10 mjansenDatabay

I reverted the fallback to sync execution if the soap call returns false. This is the case for time-consuming tasks and and would result in a double execution. The initial reason for this PR (failed call for root user due to missing acceptance of legal documents) is solved by https://github.com/ILIAS-eLearning/ILIAS/commit/38d246e153c2f13be49ac9c8ddc46b934d25e0b0.

Nevertheless, I think this PR is still useful regarding the change of the logger and the pre-check for activated SOAP.

fneumann avatar Oct 02 '24 15:10 fneumann

Thanks a lot, I squashed to one commit and picked to other branches as well

chfsx avatar Dec 17 '24 05:12 chfsx