orientjs
orientjs copied to clipboard
livequery process, keeps throwing errors when the live result is not the first in the processing queue
In cases when the processing queue contains LIVE_RESULT only on the second or third member it throws an Unhandled rejection OrientDB.ProtocolError: Unsupported operation status: 6 while 6 is the LIVE_RESULT operation status and should be fully supported this mostly happens when quite a few updates are very quickly emited
Connection.prototype.process = function (buffer, offset) {
var code, parsed, result, status, item, op, deferred, err, token, operation;
offset = offset || 0;
if(this.queue.length === 0){
op = new Operation();//TODO refactor this!
parsed = op.consume(buffer, offset);
status = parsed[0];
if (status === OperationStatus.PUSH_DATA) {
offset = parsed[1];
result = parsed[2];
this.emit('update-config', result);
return offset;
}else if(status === OperationStatus.LIVE_RESULT){
token = parsed[1];
operation = parsed[2];
result = parsed[3];
offset = parsed[4];
this.emit('live-query-result', token, operation, result);
return offset;
}
}
while ((item = this.queue.shift())) {
op = item[0];
deferred = item[1];
parsed = op.consume(buffer, offset);
status = parsed[0];
offset = parsed[1];
result = parsed[2];
if (status === OperationStatus.READING) {
// operation is incomplete, buffer does not contain enough data
this.queue.unshift(item);
return offset;
}
else if (status === OperationStatus.PUSH_DATA) {
this.emit('update-config', result);
this.queue.unshift(item);
return offset;
}
else if (status === OperationStatus.COMPLETE) {
deferred.resolve(result);
}
else if (status === OperationStatus.ERROR) {
if (result.status.error) {
// this is likely a recoverable error
deferred.reject(result.status.error);
}
else {
// cannot recover, reject everything and let the application decide what to do
err = new errors.Protocol('Unknown Error on operation id ' + op.id, result);
deferred.reject(err);
this.cancel(err);
this.emit('error', err);
}
}
else {
deferred.reject(new errors.Protocol('Unsupported operation status: ' + status));
}
}
return offset;
};
Hi @lvca ,
Any progress on this issue? Is it still assigned to 2.2? It seems to be the only issue preventing OrientDB from being integrated into Meteor.
@imdark seems to be unresponsive this past few weeks.
Cheers
Hi, We're trying to incorporate LiveQuery in our node project and always receive a particular error once multiple updates are carried out in quite a short time.
db.liveQuery("LIVE SELECT FROM FooClass").on('live-update', function(data) { console.log("Emitting update"); });
is returning:
Emitting update
Emitting update
Unhandled rejection OrientDB.ProtocolError: Unsupported operation status: 6 at Connection.process (/.../node_modules/orientjs/lib/transport/binary/connection.js:415:23) at Connection.handleSocketData (/.../node_modules/orientjs/lib/transport/binary/connection.js:281:17) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7) at readableAddChunk (_stream_readable.js:147:16) at Socket.Readable.push (_stream_readable.js:111:10) at TCP.onread (net.js:525:20)
We're using OrientDB 2.1.12 (but has been observed since 2.1.8) and OrientJS 2.1.11. Also tried with the respective 2.2 versions but in that case the callback is never called (although the very same database has cleanly been imported into both OrientDB instances), we just can't get it running in 2.2. Are any additional configuration steps necessary for 2.2 to make LiveQuery in node.js work? (btw also tried with the OrientJS 2.2.x branch - no luck).
We also tried the suggested fix (#43 transport fix for live query) - but unfortunately this lead to other errors.
Anyone experiencing similar issues? Thanks
hi @kaYcee
i'm looking at it now.
I will let you know
I'm having the same issue with OrientDb v.2.2.2. The callback for LiveQuery is NEVER called!
hey @kaYcee any news when this will be fixed...Live Query has been unusable for me since i'm relying the orientjs API.
hi @iamlogiq
which version of OrientDB and OrientJS?
@maggiolo00 Im using orientdb 2.2.8 "orientjs": "^2.2.2"
The callbacks ('live-insert, live-delete, live-update) for LiveQuery are NEVER called!
@iamlogiq
can you provide a test script ?
they are running fine in tests
https://github.com/orientechnologies/orientjs/blob/master/test/db/live-query.js
@iamlogiq
can you add the config
useToken : true
in the configuration? it should resolve
@maggiolo00 Which config file are you referring to?
hi @iamlogiq
see here
http://orientdb.com/docs/last/OrientJS-Server.html#using-tokens