Skip to content

Commit

Permalink
Revert to singular turnstile.
Browse files Browse the repository at this point in the history
  • Loading branch information
flatheadmill committed Mar 17, 2016
1 parent ad3a84b commit 71fa957
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions reactor.js
@@ -1,4 +1,4 @@
var Turnstiles = require('turnstile'),
var Turnstile = require('turnstile'),
cadence = require('cadence'),
Operation = require('operation'),
abend = require('abend'),
Expand All @@ -7,7 +7,7 @@ var Turnstiles = require('turnstile'),

function Reactor (options) {
options.operation || (options = { operation: options })
this.turnstiles = new Turnstiles({
this.turnstile = new Turnstile({
Date: options.Date,
turnstiles: options.turnstiles,
timeout: options.timeout
Expand All @@ -20,13 +20,13 @@ function Reactor (options) {

Reactor.prototype.push = function (value, callback) {
this.count++
this.turnstiles.enter({
this.turnstile.enter({
object: this, method: '_pop'
}, [ value ], function (error) {
abend(error)
if (callback) callback()
})
this.turnstiles.nudge(abend)
this.turnstile.nudge(abend)
}

Reactor.prototype._pop = cadence(function (async, state, value) {
Expand All @@ -41,22 +41,22 @@ Reactor.prototype.set = function (key, callback) {
var map = 'set'
var callbacks = this._entry(map, key)
if (callback) callbacks.push(callback)
this.turnstiles.nudge(abend)
this.turnstile.nudge(abend)
}

Reactor.prototype.check = function (callback) {
var map = 'check', key = 'default'
var callbacks = this._entry(map, key)
if (callback) callbacks.push(callback)
this.turnstiles.nudge(abend)
this.turnstile.nudge(abend)
}

Reactor.prototype._entry = function (map, key, initial) {
var callbacks = this._enqueued[map][key]
if (!callbacks) {
this.count++
callbacks = this._enqueued[map][key] = []
this.turnstiles.enter({
this.turnstile.enter({
object: this, method: '_unset'
}, [ map, key ], function (error) {
abend(error)
Expand Down
2 changes: 1 addition & 1 deletion t/reactor/reactor.t.js
Expand Up @@ -63,6 +63,6 @@ function prove (async, assert) {
}, function () {
setImmediate(async())
}, function () {
assert(reactor.turnstiles.health, { occupied: 0, waiting: 0, rejecting: 0, turnstiles: 1 }, 'health')
assert(reactor.turnstile.health, { occupied: 0, waiting: 0, rejecting: 0, turnstiles: 1 }, 'health')
})
}

0 comments on commit 71fa957

Please sign in to comment.