Skip to content

Commit 9fa211c

Browse files
committed
maybe ci pass
1 parent b13edc8 commit 9fa211c

File tree

2 files changed

+47
-43
lines changed

2 files changed

+47
-43
lines changed

lib/commands.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function load (kv) {
3131
tracker.on('moved', function () {
3232
entry.hasTracker = false
3333
const rs = streams.get(key) || []
34-
rs.forEach((stream) => stream.destroy())
34+
rs.forEach((stream) => stream.end())
3535
streams.delete(key)
3636
if (!entry.hasReplicator) {
3737
db.delete(key)
@@ -52,7 +52,7 @@ function load (kv) {
5252
logger.debug({ key }, 'configuring replicator')
5353
upring.replica(key, function () {
5454
entry.hasReplicator = false
55-
setupTracker(entry, bigError, sendData)
55+
setupTracker(entry, noop, sendData)
5656
})
5757
}
5858

@@ -79,7 +79,7 @@ function load (kv) {
7979
}
8080
} else {
8181
if (!entry.hasReplicator) {
82-
setupReplicator(entry, bigError, sendData)
82+
setupReplicator(entry, sendData)
8383
}
8484
}
8585

@@ -191,4 +191,6 @@ function load (kv) {
191191
}
192192
}
193193

194+
function noop () {}
195+
194196
module.exports = load

test/multi.test.js

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,42 @@ test('get and put', function (t) {
4848
})
4949
})
5050

51+
test('get empty', function (t) {
52+
t.plan(7)
53+
54+
const a = build()
55+
t.tearDown(a.close.bind(a))
56+
57+
a.upring.on('up', function () {
58+
t.pass('a up')
59+
const b = build(a)
60+
61+
t.tearDown(b.close.bind(b))
62+
63+
b.upring.on('up', function () {
64+
t.pass('b up')
65+
66+
b.get('hello', function (err, res) {
67+
t.error(err)
68+
t.equal(res, undefined)
69+
70+
const c = build(a)
71+
72+
t.tearDown(c.close.bind(c))
73+
74+
c.upring.on('up', function () {
75+
t.pass('c up')
76+
77+
c.get('hello', function (err, res) {
78+
t.error(err)
79+
t.equal(res, undefined)
80+
})
81+
})
82+
})
83+
})
84+
})
85+
})
86+
5187
test('moving data', function (t) {
5288
t.plan(13)
5389

@@ -161,11 +197,13 @@ test('liveUpdates', function (t) {
161197
b.put(key, 'matteo', function (err) {
162198
t.error(err)
163199

164-
b.close(function () {
165-
t.pass('closed')
200+
stream.once('data', function () {
201+
b.close(function () {
202+
t.pass('closed')
166203

167-
a.put(key, 'luca', function (err) {
168-
t.error(err)
204+
a.put(key, 'luca', function (err) {
205+
t.error(err)
206+
})
169207
})
170208
})
171209
})
@@ -174,39 +212,3 @@ test('liveUpdates', function (t) {
174212
})
175213
})
176214
})
177-
178-
test('get empty', function (t) {
179-
t.plan(7)
180-
181-
const a = build()
182-
t.tearDown(a.close.bind(a))
183-
184-
a.upring.on('up', function () {
185-
t.pass('a up')
186-
const b = build(a)
187-
188-
t.tearDown(b.close.bind(b))
189-
190-
b.upring.on('up', function () {
191-
t.pass('b up')
192-
193-
b.get('hello', function (err, res) {
194-
t.error(err)
195-
t.equal(res, undefined)
196-
197-
const c = build(a)
198-
199-
t.tearDown(c.close.bind(c))
200-
201-
c.upring.on('up', function () {
202-
t.pass('c up')
203-
204-
c.get('hello', function (err, res) {
205-
t.error(err)
206-
t.equal(res, undefined)
207-
})
208-
})
209-
})
210-
})
211-
})
212-
})

0 commit comments

Comments
 (0)