GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — sync drops messages when using ioredis client · Issue #190 · feathersjs/feathers-sync Open DescriptionTrying to utilize functions as expected with feathers@4 and feathers-sync@2: .configure( sync.redis({ key: app.get("feathers").sync.key, redisClient: new Redis({ // retry forever lazyConnect: true, maxRetriesPerRequest: null }), serialize: JSON.stringify, deserialize: JSON.parse }) ) but perhaps I missing something for feathers-sync@3? Steps to reproduce
const assert = require('assert'); const feathers = require('@feathersjs/feathers'); const { redis } = require('../../lib'); const Redis = require('ioredis'); const redisClient = new Redis({ lazyConnect: true, maxRetriesPerRequest: null }); describe('ioredis tests', () => { let app; before(done => { app = feathers() .configure(redis({ serialize: JSON.stringify, deserialize: JSON.parse, redisClient })) .use('/todo', { events: ['custom'], async create (data) { return data; } }); app.sync.ready.then(() => { done(); }); }); it('duplicates client', () => { assert.ok(redisClient.duplicate()); }); it('syncs on created with hook context', done => { const original = { test: 'data' }; app.service('todo').once('created', (data, context) => { assert.deepStrictEqual(original, data); assert.ok(context); assert.deepStrictEqual(context.result, data); assert.strictEqual(context.method, 'create'); assert.strictEqual(context.type, 'around'); assert.strictEqual(context.service, app.service('todo')); assert.strictEqual(context.app, app); done(); }); app.service('todo') .create(original) .then(data => assert.deepStrictEqual(original, data) ) .catch(done); }); it('sends sync-out for service events', done => { const message = { message: 'This is a test' }; app.once('sync-out', data => { try { assert.deepStrictEqual(data, { event: 'created', path: 'todo', data: message, context: { arguments: [message, {}], data: message, params: {}, type: 'around', statusCode: undefined, method: 'create', event: 'created', path: 'todo', result: message } }); done(); } catch (error) { done(error); } }); app.service('todo').create(message); }); }); Expected behaviorTest complete Actual behaviorTest fail AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected + '{"event":"created","path":"todo","data":{"message":"This is a test"},"context":{"arguments":[{"message":"This is a test"},{}],"event":"created","result":{"message":"This is a test"},"data":{"message":"This is a test"},"params":{},"path":"todo","method":"create","type":"around"}}' - { - context: { - arguments: [ - { - message: 'This is a test' - }, - {} - ], - data: { - message: 'This is a test' - }, - event: 'created', - method: 'create', - params: {}, - path: 'todo', - result: { - message: 'This is a test' - }, - statusCode: undefined, - type: 'around' - }, - data: { - message: 'This is a test' - }, - event: 'created', - path: 'todo' - } at Feathers.<anonymous> (test/adapters/ioredis.test.js:36:16) at Object.onceWrapper (node:events:628:26) at Feathers.emit (node:events:525:35) at service.emit (lib/core.js:2:3446) at /Users/jamesholcomb/code/feathers-sync/node_modules/@feathersjs/feathers/lib/events.js:15:55 at Array.forEach (<anonymous>) at /Users/jamesholcomb/code/feathers-sync/node_modules/@feathersjs/feathers/lib/events.js:15:21 System configurationNodeJS version: 18.12.1 Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |