Comments (4)
This is expected behavior. Interceptors always execute in order, and the contract of an Interceptor is that it takes and returns a Context. Async interceptors are migrated off of the HTTP request handling thread-pool to an async-pool until they are complete. That is, they complete asynchronously with respect to the request pool. This notion of async handling comes from the Servlet spec and matches the pattern seen in most Java Web Handlers (eg: Jetty).
You can dispatch other Futures/threads on other thread-pools and store their handles within the Context to achieve a non-blocking interceptor. If you do this, you will first want to "go async" since eventually an interceptor will await the results of dispatch.
I hope this helps clarify things
from pedestal.
@ohpauleez that makes sense now, thanks a lot!
But to be honest it is easy to get confused. Do you think a slight improvement for async interceptor docs makes sense?
from pedestal.
I'm always happy to help and I'm glad that all made sense!
Updates to the docs and additional clarification is always helpful for the project and the community. It's one of the best ways to contribute and help improve the project.
from pedestal.
I've made documentation improvements to more explicitly describe what async behavior is about, and the pitfalls therein.
from pedestal.
Related Issues (20)
- No tests for case where an interceptor is a function, and the function has ^:interceptor metadata HOT 1
- REPL Development Enhacements
- Jetty 9.x, Logback, and Java 17 Dependency Issues HOT 2
- Server Startup Error HOT 4
- io.pedestal.http.body-params/body-params could be more efficient HOT 1
- Terse syntax documentation is incomplete and confusing HOT 1
- Sample projects should be brought up to date, included in docs, built/tested with each PR or release
- Pedestal has a rarely used dependency on org.clojure.core.match that should be optional HOT 1
- clj-kondo configuration files should be packaged and distributed with associated libraries. HOT 1
- Proposal: remove the pedestal.aws library HOT 1
- 0.7.0: files and resources show up as "unrouted" in generated traces
- Jetty test uses deprecated method ServletContextHandler.setGzipHandler() HOT 1
- Allow a response map supplied by an interceptor to omit :headers and :body keys
- Better control of routing table printing for use in tests
- Spurious deprecation warnings in 0.7.0
- Master build failing after a release
- Minor issues in published 0.7.0 documentation
- Document release support strategy
- Pedestal should identify conflicting routes HOT 1
- Pedestal 0.7 - README file is very out of date HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pedestal.