Skip to content

Commit 631d1f8

Browse files
committed
When queue errors, continue processing
1 parent 0e354ab commit 631d1f8

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/simperium/channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal.changeObject = function( id, change ) {
2525
var applyChange = internal.performChange.bind( this, change );
2626

2727
this.networkQueue.queueFor( id ).add( function( done ) {
28-
return applyChange().then( done );
28+
return applyChange().then( done, done );
2929
} );
3030
};
3131

test/simperium/channel_test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ describe( 'Channel', function() {
163163
bucket.update( 'mock-id', data );
164164
} );
165165

166+
it( 'should ignore duplicate change error if nothing to acknowledge', ( done ) => {
167+
let id = 'mock-id', ccid = 'mock-ccid'
168+
// queue should emit a finish event when the change is processed
169+
channel.networkQueue.queueFor( id ).on( 'finish', () => done() )
170+
channel.handleMessage( 'c:' + JSON.stringify( [ { ccids: [ ccid ], error: 409, id }] ) )
171+
} )
172+
166173
it( 'should resend sent but unacknowledged changes on reconnect', () => new Promise( resolve => {
167174
channel.localQueue.sent['fake-ccid'] = { fake: 'change', ccid: 'fake-ccid' }
168175

0 commit comments

Comments
 (0)