Giter Site home page Giter Site logo

Comments (6)

jeremiegirault avatar jeremiegirault commented on August 28, 2024

Like NSURLSession, I think we should create a "Configuration".
The default configuration would setup the dispatch on main queue.
A custom configuration could allow the client to define its own dispatch queue.
What do you think ?

Should we consider using an output OperationQueue like NSURLSession does or stay on DispatchQueue ? We will have to keep an internal serial DispatchQueue because libetpan is not thread safe at all, but we can propose the user to define an output OperationQueue.

from postal.

klefevre avatar klefevre commented on August 28, 2024

I like your idea of a "Configuration" struct but we already have a "Configuration" parameter in the initializer related to the IMAP session. I don't like the idea of putting things like these into it.

I would suggest instead adding a simple parameter in the initializer. It would look like this:

open class Postal {
     public init(configuration: Configuration, completionQueue: OperationQueue = .main)

from postal.

jeremiegirault avatar jeremiegirault commented on August 28, 2024

Disagree, in order to future proof the API

We should indeed have a ProviderConfiguration.
We should have another struct for PostalConnection Options (separation of concerns).
We are in breaking mode so we can allow ourselves to change this, But let's assume that other options will emerge.

from postal.

klefevre avatar klefevre commented on August 28, 2024

Ok fair enough. Have you an idea of what should be added in this new structure aside the completion queue ?

from postal.

jeremiegirault avatar jeremiegirault commented on August 28, 2024

At the moment the timeout parameter is provided "ad-hoc" in the connect func :
https://github.com/snipsco/Postal/blob/master/Postal/Postal.swift#L65
All of these tweaks Which are note provider specific could go there.

from postal.

klefevre avatar klefevre commented on August 28, 2024

To answer your question. OperationQueue didn't seems to have change a lot for a while unlike DispatchQueue so in my opinion DispatchQueue would be better. Moreover I think that most of developers use it in a first place and switch to OperationQueue for a very specific case.

However we have to remember that we used an OperationQueue for libetpan because of a bug of dispatch_async that was sending some messages to the main thread..

EDIT: Personally I would like to switch to a full DispatchQueue implementation. WDYT?

from postal.

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.