-
Notifications
You must be signed in to change notification settings - Fork 74
Async parallel #1032
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
Open
emanuelGitCodes
wants to merge
37
commits into
new-main-page-UX
Choose a base branch
from
async-parallel
base: new-main-page-UX
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Async parallel #1032
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Removed the disabled locks on the menu tabs to allow user to click to report once scan started.
API now calls the aysnc refresh function instead of normal. Adds aysnc function which removes steps and calls correct function to start async scanning
- Gets course content asynchronously and then triggers scan as content is finished downloading Co-authored-by: Emanuel <[email protected]>
In the update course content in CanvasLMS it previously was creating new item, but also updating it later in code. Durning creation added the rest of the fields needed to avoid duplicate assignments.
Adds local scanner support and adds more print statements to test output
Adds to gitignore the scanner files that are downloaded from another repo. Removes usage of AuthToken in functions and passing it through etc.
…ng. This files are not complete, there more like blueprints to what to do.
…rker configuration
Co-authored-by: Emanuel <[email protected]>
Adds messenger system to queue scans. Currently queues print statement. Messenger system starts workers and runs concurrently.
Fixes issue with logging not appearing by routing log output to normal stdout and stderr
Updates the messenger to scan the content item.
Adds wait code to wait until all the message workers have completed before finishing the report.
Adds delete function to the MessageHandler instead. Adds new separatate async function to be called by the message to avoid editing current one. Updates config and adds more detaches and flushes to try and fix database saving
…nges Add Local Scanner Fixes To Branch
Re-adds routing back to the async there. Removes random return in the async refresh.
Removed equal access server to help future merges. Uncommeted the ace container since removed the files for it.
Base for supervisors
…ync-process-upgrade
…to dispatch full rescan jobs async. Force Full Rescan works and scans everything, but it runs twice. First runs scans everything, second is redundant.
…ontent scanning - Consolidate messenger worker configurations into a single directory. - Introduce new messenger handlers for concurrent and high-priority content scanning. - Update `ScanContentItem` to include content item ID and user ID. - Modify `FullRescanHandler` to dispatch `ScanContentItem` messages for updated items. - Adjust `LmsFetchService` to return updated content items for processing. Working towards having the `Force Full Rescan` process to be divided between different workers to make it faster.
…umber of browsers available on the local scanner.
…logging in rescan processes.
…vice for tracking ScanContentItem jobs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ Turning the full-course rescan pipeline fully asynchronous ✨
This PR converts our “rescan an entire course” flow from a single, blocking request into a fan-out message/worker architecture that can scale horizontally and respect Canvas API rate limits. It also introduces environment-driven pool sizing so Docker images can spin up the exact number of PHP workers and Node page-scan workers you need at deploy time.
Why
A big course could take several minutes to scan synchronously, tying up PHP-FPM and occasionally blowing past the Canvas rate limit.
We want parallel workers (both PHP messenger consumers and Node page-scan tabs) to chew through content items independently.
DevOps needs an easy knob (SCAN_POOL_SIZE) to tune concurrency per environment.
What changed
Flow – end-to-end
Workers listening on:
async_priority_high – for the FullRescanMessage (serial)
async_concurrent – for each ScanContentItem (parallel; numprocs == SCAN_POOL_SIZE)
async_priority_low – existing low-priority jobs (unchanged)
How to test locally
cp .env.example .env and set
docker compose up --build – you should see six messenger-concurrent_* workers and Node “page pool size = 6”.
Hit Rescan in the UI → request returns instantly (“queued”).
docker logs -f udoit3-php | grep ScanContentItem → each content item should be processed by different PIDs.
Confirm reports & issues populate as before.
Deployment & rollout
Safe to deploy incrementally: old endpoints still work; new workers sit idle if no FullRescanMessage arrives.
SCAN_POOL_SIZE defaults to 1 if unset, so small instances won’t spawn extra processes accidentally.
Remember to reload Supervisor after changing the env var (docker compose up -d --build handles this).
Follow-ups (not in scope here)
Replace the quick sleep()-based back-off with a shared “token bucket” Redis semaphore so all worker pods coordinate.
Add functional tests for the message fan-out path.
Surface progress back to the front-end via WebSockets or polling.
Please review & let me know if you’d like any tweaks!