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
}) })
} }
...@@ -27,13 +26,4 @@ function setValue(deviceid) { ...@@ -27,13 +26,4 @@ function setValue(deviceid) {
status: status, status: status,
offline_on: offline_on offline_on: offline_on
} }
}
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
}) })
} }
...@@ -30,13 +29,4 @@ function setValue(deviceid) { ...@@ -30,13 +29,4 @@ function setValue(deviceid) {
register_on: register_on, register_on: register_on,
last_check: last_check last_check: last_check
} }
}
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