Giter Site home page Giter Site logo

Comments (10)

adam-fowler avatar adam-fowler commented on July 30, 2024 1

@MahdiBM i guess that is the point of the issue there is no documentation covering this.

from swift-openapi-vapor.

MahdiBM avatar MahdiBM commented on July 30, 2024

What you're doing is fine.
Since a few weeks ago Vapor itself is fully Sendable, but the warnings you get are related to Fluent as you've noted, and Fluent's Sendable compatibility is still in the works.

Though you're still right that there should be more documentation on how to use swift-openapi-vapor with existing Vapor projects, and that's something we should work on.

from swift-openapi-vapor.

adam-fowler avatar adam-fowler commented on July 30, 2024

I don't think this is correct though. The UserController should store a reference to Databases not Database. Database in associated with one EventLoop. You are limiting your performance if you use this.

If you have a reference databases: Databases in your controller in your request handler you can get your Database using

let database = databases.database(on: databases.eventLoopGroup.any())

This should make full use of all of your EventLoops when performing database operations.

from swift-openapi-vapor.

MahdiBM avatar MahdiBM commented on July 30, 2024

@adam-fowler is right. database is not the only thing that should delegate to a certain eventLoop like that (e.g. client too), which happens by Vapor when used from a Request, but it's probably the most important one.

from swift-openapi-vapor.

jbehrens94 avatar jbehrens94 commented on July 30, 2024

@adam-fowler @MahdiBM Your example uses the EventLoop, does this also apply async/await projects?

from swift-openapi-vapor.

MahdiBM avatar MahdiBM commented on July 30, 2024

Vapor and basically all other server-side libraries that support async-await still use EventLoops underneath. So yes, it does apply.

from swift-openapi-vapor.

jbehrens94 avatar jbehrens94 commented on July 30, 2024

Small question @0xTim or @MahdiBM, where can I find this documentation? Swift Package Index links me to here and I can't seem to find the added documentation.

from swift-openapi-vapor.

0xTim avatar 0xTim commented on July 30, 2024

Err @MahdiBM do you know what happened to the generated tutorials?

@jbehrens94 You can see the source here https://github.com/swift-server/swift-openapi-vapor/tree/main/Sources/OpenAPIVapor/Documentation.docc/Tutorials

We'll work on getting them fixed (and the README link updated!)

from swift-openapi-vapor.

MahdiBM avatar MahdiBM commented on July 30, 2024

@jbehrens94 @0xTim It's available here: https://swiftpackageindex.com/swift-server/swift-openapi-vapor/main/tutorials/swift-openapi-vapor/requestinjection
Since i was not able to get Xcode working locally to actually test the tutorial, it looks suboptimal and it's also kind of hidden, but the content of the tutorial is what it should be so i only need to fix the "cosmetic" aspects of it.
It kind of fell out of priority after i merged it. I'll get to it probably somewhere around the weekend, assuming i can actually find a way to build the docs locally to test properly (new Xcode betas?)

from swift-openapi-vapor.

jbehrens94 avatar jbehrens94 commented on July 30, 2024

Thanks @0xTim and @MahdiBM! I'll checkout the source in the meantime and wishing you both a nice weekend :)

from swift-openapi-vapor.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.