promises icon indicating copy to clipboard operation
promises copied to clipboard

Inject TaskQueue and remove global TaskQueue?

Open mtdowling opened this issue 7 years ago • 0 comments

If we're brainstorming on 2.0 ideas... then what about removing the concept of a global dependency on a TaskQueue? In the current implementation, promises are added to a global TaskQueue. That queue can also be swapped out for other queues if needed (like React), but doing so might have implications on other aspects of an application that were relying on a different global TaskQueue's behavior. The bigger problem is that because there's a global TaskQueue, Guzzle can't be used in multiple threads.

A better approach would be to require that a promise is created with a reference to the TaskQueue so that chaining off of a promise would add the tasks to the right queue.

This kind of change would probably require another abstraction and a lot of work to ensure it is ergonomic. I'd also be interested to see if we could ensure that there is not a circular reference between a promise and a TaskQueue.

mtdowling avatar Feb 24 '17 20:02 mtdowling