WIP: Issue/718 create worker for scanning
Fixes #859 Fixes #718
Motive:
The reasoning behind the changes made in this pull request was as follows:
-
UDOIT currently does not show progress updates on the scanning process, and the scanning process sometimes takes upwards of 40 seconds, meaning that users could interpret the behavior as unresponsive and reload the page if the course is too large.
-
Heroku times out a process after 30 seconds of loading, which makes it impossible to scan large courses. As such, the refactoring of the scanning process as a worker process will allow for the scanning of larger courses.
How the scanning process worked:
- Prior to the changes made in this pull request, the way that a course was scanned was that UDOIT would make a call to the controller at
/api/sync/{course}and the controller then would call therefreshLmsContentmethod atLmsFetchService.php, which would then commence the scanning process. Finally, the controller would send back an updated version of the report.
What changed:
- Instead of running the scanning process synchronously to the rest of the backend logic. The scanning process is now isolated in a Symfony Message Handler (more commonly known as an asynchronous background worker), and this was done using Symfony Messenger.
Look into using Supervisor to see if it would be more reliable than sleep https://symfony.com/doc/current/messenger.html#supervisor-configuration