Code Monkey home page Code Monkey logo

overdrive's People

Contributors

af-rta avatar arikis avatar hffmnn avatar manwithbear avatar raimart avatar saidsikira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

overdrive's Issues

didFinish method never called when task is finished

Overdrive: 0.2.2
Package manager (SPM, Carthage, CocoaPods, Manual): CocoaPods
Xcode: 8.0
Platform: iOS 10.0

Hi,

Following your test class, I wrote a basic example:

// Custom Task
class ImageTask: Task<UIImage> {
    
    override func run() {

        let logoURL = URL(string: "http://i2.cdn.cnn.com/cnnnext/dam/assets/161217142430-2017-cars-ferrari-1-exlarge-169.jpg")!
        
        do {
            let logoData = try Data(contentsOf: logoURL)
            let image = UIImage(data: logoData)!
            finish(with: .value(image)) // finish with image
            
        } catch {
            finish(with: .error(error)) // finish with error if any
        }
    }
    
}

// Custom Task Queue
class CustomTaskQueue: TaskQueueDelegate {
    private var queue:TaskQueue
    
    public init() {
        self.queue = TaskQueue(qos: .default)
        self.queue.delegate = self
    }
    
    public func start() {
        let t1 = ImageTask()
        t1.name = "Image Task"
        t1.onValue { image in
            print("image downloaded \(image)")
        }
        
        t1.onError { error in
            print("image error \(error.localizedDescription)")
        }
        
        self.queue.add(task: t1)
    }
    
    func didAdd<T>(task: Task<T>, toQueue queue: TaskQueue) {
        print("task did add \(task.name)")
    }
    
    func didFinish<T>(task: Task<T>, inQueue queue: TaskQueue) {
        print("task did finish \(task.name)")
    }
    
}

And then call it via the following lines:

let taskQueue = CustomTaskQueue()
taskQueue.start()

The Xcode terminal log output:

task did add Optional("Image Task")
image downloaded <UIImage: 0x61800008f0a0>, {780, 438}

I can't receive the end message task did finish Optional("Image Task") when a task has been finished. I listen to the didFinish<T>(task: Task<T>, inQueue queue: TaskQueue) method but nothing happens. Did I make a mistake ?

Thank you in advance

Release with the memory leak fixed?

Overdrive: 0.2.2
Package manager (SPM, Carthage, CocoaPods, Manual): CocoaPods
Xcode: 8.3.1
Platform: iOS

Hi @Arikis,

The project I'm working on requires Overdrive to work, and while I know I'm not supposed to be asking for ETAs around here, I wanted to know if we can just release a minor bumped version of Overdrive (maybe 0.2.3) with mainly the task observer memory leak fixed. I would be happy to help in any way I can.

maxConcurrentCount=1 only executes the first task in the queue

Overdrive: 0.3
Package manager (SPM, Carthage, CocoaPods, Manual): n/a
Xcode: 8.3.2 (macOS 10.12.5)
Platform: iOS

When TaskQueue.maximumConcurrentTaskCount = 1`, only one task is executed. (The 2nd task is not executed.)

Here is a test case that indicates the issue.

    func testTwoTaskShouldBothCompleteWhenMaxConcurrentTaskCountIsOne() {

        queue.maxConcurrentTaskCount = 1

        let expectation1 = self.expectation(description: "a")
        let expectation2 = self.expectation(description: "b")

        let task = anyTask(withResult: .value(1))
        task.onValue { _ in
            expectation1.fulfill()
        }
        let task2 = anyTask(withResult: .value(1))
        task2.onValue { _ in
            expectation2.fulfill()
        }
        queue.add(task: task)
        queue.add(task: task2)

        waitForExpectations(timeout: 5)

    }

The test fails as the "b" expectation is unfulfilled. Any ideas what could be wrong?

Retry triggered on success?

Overdrive: 0.2.1
Package manager (SPM, Carthage, CocoaPods, Manual): Cocoapods 1.1
Xcode: 8.2 beta 2
Platform: iOS 10

Running a simple, non-failable task with retry, retries even if the task finishes without error.

let inlineTask = InlineTask { (_) in
    print("inlineTask")
}.retry(2)

queue.add(task: inlineTask)

prints inlineTask 3 Times to the console, even if the documentation of retry states:

If the task finishes with error, it will be executed again until retry count becomes zero.

`maxConcurrentTaskCount` is inaccessible for clients

Overdrive version: 0.2.0

Package manager: CocoaPods 1.1

This snippet

let queue = TaskQueue()
queue.maxConcurrentTaskCount = 3

throws 'maxConcurrentTaskCount' is inaccessible due to 'internal' protection level. See #2 for a possible fix.

iOS 11 Crashes - Invalid State Transformation while Evaluating Conditions

Overdrive: 0.3
Package manager (SPM, Carthage, CocoaPods, Manual): CocoaPods
Xcode: 9.0 beta 6
Platform: iOS

The dependency system seems to be failing in iOS 11. I have tried this with Xcode 9 betas 6 & 7 (latest right now). Quite a few tests are failing, especially an assertion failure TaskConditionTests, which seems to be the most severe, which actually is affecting our production users on iOS betas with crashes.

Tasks added to suspended TaskQueue won't run

Overdrive: 0.2.2
Package manager (SPM, Carthage, CocoaPods, Manual): CocoaPods
Xcode: 8.2.1
Platform: iOS 10

Tasks added to a TaskQueue being suspended don't run after setting isSuspended = false. Seems to be a Task specific issue because adding a BlockOperation to the TaskQueue's internal OperationQueue does not cause this issue. Please notice the attached sample code.
ViewController.swift.zip

SynchronousTask not finishing if result property is not set

Description:
Since SynchronousTask implementation relies on result property being set to finish, not setting the result property would make the task execute forever.

Proposed fix:
Add internal method to finish the task if the result is not set.

Support for Many to One Dependencies

Overdrive: 0.2.2
Package manager (SPM, Carthage, CocoaPods, Manual): CocoaPods
Xcode: 8.2.1
Platform: iOS

Are there any plans for supporting repeat dependencies? For example, if I add a task A which depends on the task Z, both Z and A get added to the queue.

Now, if I have a task B, which depends on the same instance of task Z as earlier, and I add B, it crashes because I have added the same instance of task Z again to the queue.

What could be the other behaviour is that when Z came in the first time, Z would have been added to the queue, but the second time, Z would have simply been added as a dependency for B.

Let me know if this is too specific to my requirements, or it's something we can have at Overdrive level?

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.