Fixed device updates being processed twice potentially impacting performance.
This commit is contained in:
1 parent
7d3618a480
commit
141102908c
1 file changed
+2
-4
+2
-4
@@ -227,9 +227,6 @@ runTask = (currentRequest, task, methodResponse) ->
|
||||
timeDiff = process.hrtime()
|
||||
tasks.task(task, methodResponse, (err, status, methodRequest, deviceUpdates) ->
|
||||
throw err if err
|
||||
# TODO handle error
|
||||
updateDevice.queueUpdates(currentRequest.session.deviceId, deviceUpdates, (err) ->
|
||||
throw err if err
|
||||
|
||||
timeDiff = process.hrtime(timeDiff)[0] + 1
|
||||
if timeDiff > 3 # in seconds
|
||||
@@ -260,7 +257,9 @@ runTask = (currentRequest, task, methodResponse) ->
|
||||
)
|
||||
)
|
||||
else
|
||||
updateDevice.queueUpdates(currentRequest.session.deviceId, deviceUpdates, (err) ->
|
||||
f()
|
||||
)
|
||||
when tasks.STATUS_COMPLETED
|
||||
util.log("#{currentRequest.session.deviceId}: Completed task #{task.name}(#{task._id})")
|
||||
updateDevice.commitUpdates(currentRequest.session.deviceId, deviceUpdates, true, (err) ->
|
||||
@@ -287,7 +286,6 @@ runTask = (currentRequest, task, methodResponse) ->
|
||||
else
|
||||
throw new Error('Unknown task status')
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
isTaskExpired = (task) ->
|
||||
|
||||
Reference in new issue
Block a user