tblobaum / redis-stream Goto Github PK
View Code? Open in Web Editor NEWstreaming redis client for node
License: MIT License
streaming redis client for node
License: MIT License
When redis replies with a reply meaning no records are found it is +OK/r/n*0
.
The replyParser
function returns fn()
as a result making the pipe stop altogether (filter). It seems like it is more suitable to reply with fn(null, [])
since the redis docs an empty list is presumed when a key doesn't exist. (http://redis.io/topics/protocol#status-reply)
This would permit the piping to continue as expected IMO.
Does this reasoning seem sound?
I'm using this library in one app and it's quit nice but recently I'm getting too much open connections on Redis and I was checking one thing here might be a possible cause.
I can see in https://github.com/tblobaum/redis-stream/blob/master/index.js#L26 that you are creating the connection but you I cannot see where you end that connection
var express = require('express');
var Redis = require('redis-stream');
var app = express();
var client = new Redis(6379, 'localhost');
app.get('/account', function (req, res) {
console.log('Request');
var stream = client.stream('mget');
stream.pipe(Redis.es.join('\r\n')).pipe(res);
stream.write(['56b4f9698b02003d23cc8f17:listings', '56b4f9698b02003d23cc8f17:items']);
stream.end();
});
app.listen(9999, function () {
console.log('Listening...');
});
I am having trouble with express + redis-stream, but it is probably just streams in general.
I pipe the redis-stream to the express response stream, and I see the data
but the request keeps perpetually loading
I am lead to believe I need to call .end()
but if I do, it seems the pipe never makes it and everything gets closed before any data is piped
Hi,
I was trying to use the auth method but seemed not working, then I saw that into the code is missing the logic to take care about the auth part.
I also tried to add it by myself and it worked with two lines of code, am I missing something or there are better ways to achieve this goal?
Many Thanks Guys!
PS.
This is what I've done:
function Redis (port, host, db, auth) {
this.port = port || 6379
this.host = host || 'localhost'
this.db = String(db || 0)
this.auth = auth || ''
return this
}
...
stream.redis = _redis
stream.redis.write(Redis.parse([ 'auth', this.auth ]))
stream.redis.write(Redis.parse([ 'select', this.db ]))
return stream
...
thank you so much for having a great mind and thinking with sanity. streams should be the core of any library that likely needs to process a lot of data. but, it begs the question... why isn't this just part of node-redis? could you please collaborate with the author and make that happen? it seems inane to have to use two different libraries to talk to redis.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.