From 320bbec7377ea4fac81962f570d3edd24ba16bcd Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 25 Jun 2015 18:00:07 +0100 Subject: [PATCH] Add MatrixScheduler.getQueue to allow items in the queue to be modified. --- CHANGELOG.md | 3 +++ lib/scheduler.js | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 160faba61..934456d6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Changes in 0.1.2 ================ +New methods: + * `MatrixScheduler.getQueue(name)` + Bug fixes: * Fixed an issue which prevented RoomMember.name being disambiguated if there was exactly 1 other person with the same display name. diff --git a/lib/scheduler.js b/lib/scheduler.js index 2bc3ca34b..bb4beb474 100644 --- a/lib/scheduler.js +++ b/lib/scheduler.js @@ -35,6 +35,17 @@ function MatrixScheduler(retryAlgorithm, queueAlgorithm) { this._procFn = null; } +/** + * Retrieve a queue by name. Useful if you want to remove items from the queue, + * or re-order items in the queue. + * @param {string} name The name of the queue. + * @return {?Array} The queue or null. The queue consists of objects + * containing 3 properties: event, defer, attempts. + */ +MatrixScheduler.prototype.getQueue = function(name) { + return this._queues[name] || null; +}; + /** * Set the process function. Required for events in the queue to be processed. * If set after events have been added to the queue, this will immediately start