Browse Source

__task_id -> _taskId

pull/1/head
Alexey Velikiy 7 years ago
parent
commit
56969bdb9d
  1. 4
      analytics/server.py
  2. 6
      server/src/controllers/analytics_controller.ts

4
analytics/server.py

@ -29,12 +29,12 @@ def handleTask(text):
socket.send_string(json.dumps({
'task': task['type'],
'predictor_id': task['predictor_id'],
'__task_id': task['__task_id'],
'_taskId': task['_taskId'],
'status': "in progress"
}))
res = w.do_task(task)
res['__task_id'] = task['__task_id']
res['_taskId'] = task['_taskId']
socket.send_string(json.dumps(res))
except Exception as e:

6
server/src/controllers/analytics_controller.ts

@ -10,7 +10,7 @@ let nextTaskId = 0;
const analyticsService = new AnalyticsService(onResponse);
function onResponse(response: any) {
let taskId = response.__task_id;
let taskId = response._taskId;
let status = response.status;
if(status === 'success' || status === 'failed') {
if(taskId in taskMap) {
@ -28,11 +28,11 @@ async function runTask(task): Promise<any> {
targets: anomaly.metric.targets.map(getTarget)
};
task.__task_id = nextTaskId++;
task._task_id = nextTaskId++;
await analyticsService.sendTask(task);
return new Promise<void>(resolve => {
taskMap[task.__task_id] = resolve;
taskMap[task._taskId] = resolve;
})
}

Loading…
Cancel
Save