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

lazy middleware #1507

merged 27 commits into from Feb 20, 2018


None yet
2 participants
Copy link

tanner0101 commented Feb 19, 2018

  • creates one set of middleware per event loop, preventing race conditions in middleware
  • losslessly optimizes DateMiddleware to only calculate a new RFC1123 timestamp every second
  • adds a new router.grouped(MiddlewareType.self) overload for creating a route group around a middleware type that will be lazily initialized (on the event loop) when requested.
router.grouped(DateMiddleware.self).get("datetest") { req in
    return HTTPStatus.ok

In the above snippet, DateMiddleware won't be initialized until the first time that route is hit. It will subsequently be initialized for each event loop, until all event loops have one cached.

  • adds application-wide timeout for requests taking longer than 30 seconds
[ ERROR ] Vapor.VaporError.timeout: The application timed out waiting for response. (Services+Default.swift:207)
[ DEBUG ] Suggested fixes for Vapor.VaporError.timeout: Inspect the route responsible for responding to GET /fcm (EngineServer.swift:198)

Resolves #1479.

MaximBazarov and others added some commits Dec 24, 2017

refactor RoutingGroups
add RoutingGroups test
add PathComponent equitable functions

@tanner0101 tanner0101 self-assigned this Feb 19, 2018

@tanner0101 tanner0101 added this to Todo in Vapor 3 Feb 20, 2018

@tanner0101 tanner0101 referenced this pull request Feb 20, 2018


Updated RoutingGroups #1388

tanner0101 added some commits Feb 20, 2018

Merge pull request #1388 from MaximBazarov/beta
Updated RoutingGroups

@tanner0101 tanner0101 added this to the 3.0.0-beta.4 milestone Feb 20, 2018

@tanner0101 tanner0101 merged commit 3f3bc67 into beta Feb 20, 2018

2 checks passed

ci/circleci: linux Your tests passed on CircleCI!
dependency-ci Dependencies checked

@tanner0101 tanner0101 deleted the lazy-middleware branch Feb 20, 2018

@tanner0101 tanner0101 moved this from Todo to Done in Vapor 3 Feb 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment