Fixed saving task in addObject. Should be saved after receiving instance number rather than before.
This commit is contained in:
1 parent
7828142391
commit
6b359c8dfb
1 file changed
+6
-3
+6
-3
@@ -238,8 +238,7 @@ this.addObject = (task, methodResponse, callback) ->
|
|||||||
task.parameterNames = []
|
task.parameterNames = []
|
||||||
allDeviceUpdates.instanceName = [["#{task.objectName}.#{task.instanceNumber}", task.instanceName]] if task.instanceName?
|
allDeviceUpdates.instanceName = [["#{task.objectName}.#{task.instanceNumber}", task.instanceName]] if task.instanceName?
|
||||||
else
|
else
|
||||||
# Use STATUSS_SAVE to avoid adding object again in case of failure
|
callback(null, STATUS_STARTED, {methodRequest : {type : 'AddObject', objectName : "#{task.objectName}."}})
|
||||||
callback(null, STATUS_SAVE, {methodRequest : {type : 'AddObject', objectName : "#{task.objectName}."}})
|
|
||||||
return
|
return
|
||||||
|
|
||||||
subtask = () =>
|
subtask = () =>
|
||||||
@@ -255,7 +254,11 @@ this.addObject = (task, methodResponse, callback) ->
|
|||||||
task.subtask = {name : 'getParameterValues', parameterNames : task.parameterNames}
|
task.subtask = {name : 'getParameterValues', parameterNames : task.parameterNames}
|
||||||
subtask()
|
subtask()
|
||||||
else if status is STATUS_STARTED
|
else if status is STATUS_STARTED
|
||||||
callback(err, STATUS_STARTED, cwmpResponse, allDeviceUpdates)
|
if allDeviceUpdates.instanceName?
|
||||||
|
# Use STATUSS_SAVE to avoid adding duplicate object in case of error
|
||||||
|
callback(err, STATUS_SAVE, cwmpResponse, allDeviceUpdates)
|
||||||
|
else
|
||||||
|
callback(err, STATUS_STARTED, cwmpResponse, allDeviceUpdates)
|
||||||
else
|
else
|
||||||
throw Error('Unexpected subtask status')
|
throw Error('Unexpected subtask status')
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user