Skip to content

Comments

Allow middleware access to job queue#123

Merged
adam-fowler merged 3 commits intomainfrom
middleware-access-to-queue
Jan 29, 2026
Merged

Allow middleware access to job queue#123
adam-fowler merged 3 commits intomainfrom
middleware-access-to-queue

Conversation

@adam-fowler
Copy link
Member

One of the limitations of job middleware was it wasn't possible to construct a middleware that held the job queue. This PR resolves this by providing a separate initialiser for JobQueue which passes the queue driver to the closure that constructs the middleware chain.

let jobQueue = JobQueue(.memory, logger: logger) { queue in
    TestMiddleware(queue: queue)
}

For instance this could be used to create a middleware that sets metadata on job completion

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.39%. Comparing base (93d35fd) to head (458715a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #123      +/-   ##
==========================================
+ Coverage   86.81%   87.39%   +0.57%     
==========================================
  Files          25       25              
  Lines        1320     1325       +5     
==========================================
+ Hits         1146     1158      +12     
+ Misses        174      167       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adam-fowler adam-fowler merged commit f0345f4 into main Jan 29, 2026
7 of 8 checks passed
@adam-fowler adam-fowler deleted the middleware-access-to-queue branch January 29, 2026 08:36
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

Successfully merging this pull request may close these issues.

2 participants