Make sync enrollments and sync assignments async with Good_job gem#345
Make sync enrollments and sync assignments async with Good_job gem#345
Conversation
Bumps the npm_and_yarn group with 1 update in the / directory: [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser). Updates `fast-xml-parser` from 5.4.1 to 5.5.6 - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](NaturalIntelligence/fast-xml-parser@v5.4.1...v5.5.6) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-version: 5.5.6 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
Mass approve/ reject functionality and UI changes for request table
Add semester field to courses
…admin guard with student? helper method.
…n; Use pluck('name') instead of map in specs. Fix find_by returning wrong enrollment by reusing course_admin? method that checks all enrollments.
…er-filter Add semester filter to Import Courses page
Autocorrect some small rspec cases
…dates A bunch of small dependency updates
…dates Bump Rails to latest 7.2 patch
…taff-view Enrollments staff view and semester filter
Bumps the bundler group with 1 update in the / directory: [rack-session](https://github.com/rack/rack-session). Updates `rack-session` from 2.1.1 to 2.1.2 - [Release notes](https://github.com/rack/rack-session/releases) - [Changelog](https://github.com/rack/rack-session/blob/main/releases.md) - [Commits](rack/rack-session@v2.1.1...v2.1.2) --- updated-dependencies: - dependency-name: rack-session dependency-version: 2.1.2 dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] <support@github.com>
…ndler/bundler-c64e476597
Bumps the bundler group with 1 update in the / directory: [addressable](https://github.com/sporkmonger/addressable). Updates `addressable` from 2.8.9 to 2.9.0 - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](sporkmonger/addressable@addressable-2.8.9...addressable-2.9.0) --- updated-dependencies: - dependency-name: addressable dependency-version: 2.9.0 dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.86.0 to 1.86.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop@v1.86.0...v1.86.1) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.86.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [strong_migrations](https://github.com/ankane/strong_migrations) from 2.5.2 to 2.6.0. - [Changelog](https://github.com/ankane/strong_migrations/blob/master/CHANGELOG.md) - [Commits](ankane/strong_migrations@v2.5.2...v2.6.0) --- updated-dependencies: - dependency-name: strong_migrations dependency-version: 2.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…ndler/bundler-2ba255671e Bump addressable from 2.8.9 to 2.9.0 in the bundler group across 1 directory
…m_and_yarn/npm_and_yarn-e78c89ff38 Bump fast-xml-parser from 5.4.1 to 5.5.6 in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 3 updates in the / directory: [picomatch](https://github.com/micromatch/picomatch), [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) and [handlebars](https://github.com/handlebars-lang/handlebars.js). Updates `picomatch` from 4.0.3 to 4.0.4 - [Release notes](https://github.com/micromatch/picomatch/releases) - [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md) - [Commits](micromatch/picomatch@4.0.3...4.0.4) Updates `picomatch` from 2.3.1 to 2.3.2 - [Release notes](https://github.com/micromatch/picomatch/releases) - [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md) - [Commits](micromatch/picomatch@4.0.3...4.0.4) Updates `fast-xml-parser` from 5.5.6 to 5.5.12 - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/commits) Updates `handlebars` from 4.7.8 to 4.7.9 - [Release notes](https://github.com/handlebars-lang/handlebars.js/releases) - [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/v4.7.9/release-notes.md) - [Commits](handlebars-lang/handlebars.js@v4.7.8...v4.7.9) --- updated-dependencies: - dependency-name: picomatch dependency-version: 4.0.4 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: picomatch dependency-version: 2.3.2 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: fast-xml-parser dependency-version: 5.5.12 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: handlebars dependency-version: 4.7.9 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
cycomachead
left a comment
There was a problem hiding this comment.
This looks pretty good!
I'll give more detailed feedback, but I don't think we need too many changes.
Can you enable the web dashboard and make sure it's behind checkin the user is an admin?
https://claude.ai/share/0c4d073f-0168-4277-a6c1-2425e47f0e28
This is protected by
|
…m_and_yarn/npm_and_yarn-56a676e30a Bump the npm_and_yarn group across 1 directory with 3 updates
…ndler/rubocop-1.86.1 Bump rubocop from 1.86.0 to 1.86.1
…ndler/strong_migrations-2.6.0 Bump strong_migrations from 2.5.2 to 2.6.0
|
|
||
| # This is protected by `require_admin` via blazer.yml | ||
| mount Blazer::Engine, at: "admin/blazer" | ||
| mount GoodJob::Engine, at: "admin/good_job" |
There was a problem hiding this comment.
Was this particular commit deployed to Heroku?
I just tried /admin/good_job and it didn't work (404), but /good_job less to a 500.
|
Thanks! One small question. I think the main branch or each repo should probably be synced up again |
|
Actually I take that back /admin/good_job exists, but I think there's an error with the authentication for some reason. |
General Info
We need a framework to run async functions in the background (show status syncing). Async cast (sync enrollments/assignments should show status). We don’t want to wait 30/ 60s as per the current implementation
Changes
Previously, "Sync Enrollments" and "Sync Assignments" were synchronous: the HTTP request would block until all Canvas API calls completed, which could take 30–60 seconds and risk timing out. This PR makes both operations asynchronous using GoodJob, a PostgreSQL-backed Active Job backend.
Background job infrastructure:
Added GoodJob gem and ran its migration to create the good_jobs table in Postgres
Configured config.active_job.queue_adapter = :good_job in application.rb
Added a Procfile so Heroku runs a separate worker dyno alongside web
Added dotenv-rails gem to support loading .env locally
Async sync behavior:
Course#sync_assignments and Course#sync_users_from_canvas now call perform_later instead of running inline; the controller returns immediately after enqueuing
Added GET /courses/:id/sync_status endpoint that returns the last roster_synced_at / assignments_synced_at timestamps from CourseToLms
UI:
Both sync buttons now disable and show a "Syncing..." label + spinner immediately on click
The Stimulus controllers poll /sync_status every 1 second and reload the page with a banner notification once the job's timestamp changes, confirming completion
On timeout (60s) or error, an alert flash is shown and the button re-enabled
Testing
Added a full RSpec spec for SyncUsersFromCanvasJob covering: user upsert, enrollment creation, role-based removal, multi-role sync, return values/persistence, and non-array Canvas error responses
Rewrote the stale pending spec for SyncAllCourseAssignmentsJob#sync_assignment to test the instance method directly (create, update, unchanged)
Updated course_spec to verify sync_users_from_canvas enqueues the job rather than running inline
Added Cucumber scenarios for both sync buttons: visibility, disabled state, and spinner appearance after clicking
Set config.good_job.execution_mode = :external in test.rb to prevent GoodJob from executing jobs in-process during tests (which would cause the page to reload before Capybara could assert on the loading state)
Documentation
No documentation needed
Checklist