Remove old pending tasks when the device sends bootstrap event

This commit is contained in:
Zaid Abdulla committed 2014-04-21 23:24:21 +03:00
1 parent 10be06c619
commit 4eb7867695
1 file changed
+7 -1
+7 -1
View File
@@ -137,7 +137,13 @@ inform = (currentRequest, cwmpRequest) ->
actions = {parameterValues : cwmpRequest.methodRequest.parameterList, set : {}} actions = {parameterValues : cwmpRequest.methodRequest.parameterList, set : {}}
actions.set._lastInform = now actions.set._lastInform = now
actions.set._lastBoot = now if '1 BOOT' in cwmpRequest.methodRequest.event actions.set._lastBoot = now if '1 BOOT' in cwmpRequest.methodRequest.event
actions.set._lastBootstrap = lastBootstrap = now if '0 BOOTSTRAP' in cwmpRequest.methodRequest.event
if '0 BOOTSTRAP' in cwmpRequest.methodRequest.event
actions.set._lastBootstrap = lastBootstrap = now
# ignore all pending tasks
db.tasksCollection.remove({device : currentRequest.deviceId}, (err, removed) ->
throw err if err
)
db.redisClient.get("#{currentRequest.deviceId}_inform_hash", (err, oldInformHash) -> db.redisClient.get("#{currentRequest.deviceId}_inform_hash", (err, oldInformHash) ->
throw err if err throw err if err