Giter Club home page Giter Club logo

Comments (2)

groue avatar groue commented on June 9, 2024 1

Hello @leotumwattana,

This is a warning about sub-optimal use of threads. Check Apple documentation Diagnosing performance issues early in order to understand what this warning is about.

There are already a few GRDB issues opened about priority inversion warnings. Take care that some applications instruct GRDB to perform the wrong actions: it's important that you understand the above Apple documentation. By default, all database operations run with the userInitiated quality of service (see Configuration.qos).

Finally, check if your application performs any synchronous database access from an asynchronous Task:

// WRONG APPLICATION PATTERN

// An async function...
func asyncFunction() async throws {
    try performSyncDatabaseAccess()
}

func performSyncDatabaseAccess() throws {
    // ...should not call a synchronous database access method.
    try dbPool.read { db in... } // sync
}

If this happens, refactor your app so that all database accesses performed from a Task are asynchronous:

// CORRECT APPLICATION PATTERN

// An async function...
func asyncFunction() async throws {
    try await performAsyncDatabaseAccess()
}

func performAsyncDatabaseAccess() async throws {
    // ...can call asynchronous database access methods.
    try await dbPool.read { db in... } // async
}

from grdb.swift.

leotumwattana avatar leotumwattana commented on June 9, 2024

Thanks @groue!

from grdb.swift.

Related Issues (20)

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.