Commit ba57a43bf6d04e74ed5220d16dc089609ce83dd7

Authored by Adhidarma Hadiwinoto
1 parent 94007c6eff
Exists in master

rapihkan beberapa hal

Showing 2 changed files with 7 additions and 1 deletions Side-by-side Diff

... ... @@ -25,7 +25,9 @@ function _buy(task) {
25 25 }
26 26 }
27 27  
28   -function buy(task) {
  28 +function buy(_task) {
  29 + let task = JSON.parse(JSON.stringify(_task));
  30 +
29 31 logger.verbose('Buy on partner', {task: task});
30 32 setTimeout(
31 33 function() {
... ... @@ -29,14 +29,18 @@ function pullTask() {
29 29 request(options, function(error, response, body) {
30 30 if (error) {
31 31 logger.warn('Error pulling task from CORE', {error: error});
  32 + matrix.core_is_healthy = false;
32 33 return;
33 34 }
34 35  
35 36 if (response.statusCode != 200) {
36 37 logger.warn('CORE http response status code for pull task is not 200', {http_response_status: response.statusCode});
  38 + matrix.core_is_healthy = false;
37 39 return;
38 40 }
39 41  
  42 + matrix.core_is_healthy = true;
  43 +
40 44 if (body == 'NONE') {
41 45 return;
42 46 }