Skip to content
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

Queue not running #19

Open
sameerKLT opened this issue Oct 13, 2017 · 1 comment
Open

Queue not running #19

sameerKLT opened this issue Oct 13, 2017 · 1 comment

Comments

@sameerKLT
Copy link

The following is the setup and the issue I am running into:

  • Singleton object contains a TaskQueue object.
  • At some point, when deemed correct(attempt at unauthorized use), the TaskQueue object is cleared using remove all
  • Afterwards, when trying to add tasks to TaskQueue object, tasks in the queue are not being run.
let queue = TaskQueue()

func init() {
     downloadStuff()
}

func downloadStuff() {
   queue.tasks += {[weak queue] result, next in

       myTask(completion: { success in
          if success {
               next(nil)
          }
          else {
             print("error out")
          }
       }

   }

   queue.run() {
       print("completed")
   }
}

func unauthorizedUse() {
     queue.removeAll()
}

func authorizedUse() {
     downloadStuff()
}
@icanzilb
Copy link
Owner

hey, in general the taskqueue class was meant to be a one-off object, I personally haven't tested situations where it has a long life cycle and is being re-used all the time. if you figure something out - make a PR 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants