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

Support iterable #2

Open
dinoboff opened this issue May 4, 2018 · 0 comments
Open

Support iterable #2

dinoboff opened this issue May 4, 2018 · 0 comments

Comments

@dinoboff
Copy link

dinoboff commented May 4, 2018

Instead of calling next tick, an iterable task would just yield. The task should either return the last value, an array of all the values or void.

/**
 * Maintains a set of queues, each with their own QueueScheduler to schedule
 * task execution.
 */
class Scheduler {
  addQueue(name: string, scheduler: QueueScheduler): void;

  /**
   * Schedule a task on a named queue. The queue must already exist via a call
   * to `addQueue`.
   *
   * TODO: Accept a CancelToken
   */
  scheduleTask<T>(queueName: string, task: TaskFunction<T>): Promise<T>;
  scheduleTask<T>(queueName: string, task: IterableIterator<T>): Promise<T>;
  scheduleTask<T>(queueName: string, task: AsyncIterableIterator<T>): Promise<T>;
}
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

1 participant