Skip to content

Commit

Permalink
add strict to redisout and fa-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dceejay committed Jul 17, 2014
1 parent 2b423fe commit fea68d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
12 changes: 6 additions & 6 deletions nodes/core/storage/65-redisout.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

<script type="text/x-red" data-template-name="redis out">
<div class="form-row node-input-hostname">
<label for="node-input-hostname"><i class="icon-bookmark"></i> Host</label>
<label for="node-input-hostname"><i class="fa fa-bookmark"></i> Host</label>
<input class="input-append-left" type="text" id="node-input-hostname" placeholder="127.0.0.1" style="width: 40%;" ><button id="node-input-hostname-lookup" class="btn input-append-right"><span class="caret"></span></button>
<label for="node-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
<input type="text" id="node-input-port" placeholder="6379" style="width:45px">
</div>
<div class="form-row">
<label for="node-input-key"><i class="icon-briefcase"></i> Key</label>
<label for="node-input-key"><i class="fa fa-key"></i> Key</label>
<input type="text" id="node-input-key" placeholder="Redis Key">
</div>
<div class="form-row">
<label for="node-input-type"><i class="icon-th"></i> Type</label>
<label for="node-input-type"><i class="fa fa-th"></i> Type</label>
<select type="text" id="node-input-structtype" style="width: 150px;">
<option value="string">String</option>
<option value="hash">Hash</option>
Expand All @@ -35,7 +35,7 @@
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">
Expand All @@ -45,8 +45,8 @@
</script>

<script type="text/x-red" data-help-name="redis out">
<p>A Redis output node. Options include Hash, Set, List and String.</p>
<p>To run this you need a local Redis server running. For details see <a href="http://redis.io/" target="_new">the Redis site</a>.</p>
<p>A Redis output node. Options include Hash, Set, List and String.</p>
<p>To run this you need a local Redis server running. For details see <a href="http://redis.io/" target="_new">the Redis site</a>.</p>
</script>

<script type="text/javascript">
Expand Down
22 changes: 10 additions & 12 deletions nodes/core/storage/65-redisout.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
**/

module.exports = function(RED) {
"use strict";
var util = require("util");
var redis = require("redis");

var hashFieldRE = /^([^=]+)=(.*)$/;

var redisConnectionPool = function() {
var connections = {};
var obj = {
Expand All @@ -41,7 +42,7 @@ module.exports = function(RED) {
},
close: function(connection) {
connection._nodeCount -= 1;
if (connection._nodeCount == 0) {
if (connection._nodeCount === 0) {
if (connection) {
clearTimeout(connection.retry_timer);
connection.end();
Expand All @@ -52,15 +53,15 @@ module.exports = function(RED) {
};
return obj;
}();


function RedisOutNode(n) {
RED.nodes.createNode(this,n);
this.port = n.port||"6379";
this.hostname = n.hostname||"127.0.0.1";
this.key = n.key;
this.structtype = n.structtype;

this.client = redisConnectionPool.get(this.hostname,this.port);

if (this.client.connected) {
Expand Down Expand Up @@ -100,12 +101,9 @@ module.exports = function(RED) {
}
}
});
this.on("close", function() {
redisConnectionPool.close(node.client);
});
}

RED.nodes.registerType("redis out",RedisOutNode);

RedisOutNode.prototype.close = function() {
redisConnectionPool.close(this.client);
}
}

1 comment on commit fea68d4

@hindessm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dave,

I'm curious, particularly since 10-mqtt.js still uses the "old" way and is "strict", why you changed the close code?

Regards,
Mark

Please sign in to comment.