Commit 20f5db56 by zCaesar

set to default

parent 569251f8
...@@ -9,7 +9,6 @@ function on_offline_redis(deviceid) { // first time to access on authhook auth_o ...@@ -9,7 +9,6 @@ function on_offline_redis(deviceid) { // first time to access on authhook auth_o
else { else {
var information = setValue(deviceid) var information = setValue(deviceid)
redis.hset(information.keys, 'status', information.status, 'offline_on', information.offline_on, function (err, res) { redis.hset(information.keys, 'status', information.status, 'offline_on', information.offline_on, function (err, res) {
redis.hset(setBrokerValue().keys, 'device_client_count', setBrokerValue().device_client_count)
resolve(!res) // 0 is ok, 1 is no => if ok is 0 then not 0 = 1 resolve(!res) // 0 is ok, 1 is no => if ok is 0 then not 0 = 1
}) })
} }
...@@ -28,12 +27,3 @@ function setValue(deviceid) { ...@@ -28,12 +27,3 @@ function setValue(deviceid) {
offline_on: offline_on offline_on: offline_on
} }
} }
\ No newline at end of file
function setBrokerValue() {
var keys = '_broker:1'
var device_client_count = redis.dbsize() - 1
return {
keys: keys,
device_client_count: device_client_count
}
}
\ No newline at end of file
...@@ -10,7 +10,6 @@ function on_register_redis(deviceid) { // first time to access on authhook auth_ ...@@ -10,7 +10,6 @@ function on_register_redis(deviceid) { // first time to access on authhook auth_
var information = setValue(deviceid) var information = setValue(deviceid)
redis.hdel(information.keys, 'offline_on') redis.hdel(information.keys, 'offline_on')
redis.hset(information.keys, 'status', information.status, 'register_on', information.register_on, 'last_check', information.last_check, function (err, res) { redis.hset(information.keys, 'status', information.status, 'register_on', information.register_on, 'last_check', information.last_check, function (err, res) {
redis.hset(setBrokerValue().keys, 'device_client_count', setBrokerValue().device_client_count)
resolve(!res) // 0 is ok, 1 is no => if ok is 0 then not 0 = 1 resolve(!res) // 0 is ok, 1 is no => if ok is 0 then not 0 = 1
}) })
} }
...@@ -31,12 +30,3 @@ function setValue(deviceid) { ...@@ -31,12 +30,3 @@ function setValue(deviceid) {
last_check: last_check last_check: last_check
} }
} }
\ No newline at end of file
function setBrokerValue() {
var keys = '_broker:1'
var device_client_count = redis.dbsize() - 1
return {
keys: keys,
device_client_count: device_client_count
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment