| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library server.operation; | 5 library server.operation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 void processResult( | 104 void processResult( |
| 105 String id, Map<String, dynamic> result, Stopwatch stopwatch) { | 105 String id, Map<String, dynamic> result, Stopwatch stopwatch) { |
| 106 converter.processResponseResult(id, result); | 106 converter.processResponseResult(id, result); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * A [ResponseOperation] waits for a [JSON] response from the server. | 111 * A [ResponseOperation] waits for a [JSON] response from the server. |
| 112 */ | 112 */ |
| 113 class ResponseOperation extends Operation { | 113 class ResponseOperation extends Operation { |
| 114 static final Duration responseTimeout = new Duration(seconds: 5); | 114 static final Duration responseTimeout = new Duration(seconds: 60); |
| 115 final CommonInputConverter converter; | 115 final CommonInputConverter converter; |
| 116 final Map<String, dynamic> requestJson; | 116 final Map<String, dynamic> requestJson; |
| 117 final Map<String, dynamic> responseJson; | 117 final Map<String, dynamic> responseJson; |
| 118 final Completer completer = new Completer(); | 118 final Completer completer = new Completer(); |
| 119 Driver driver; | 119 Driver driver; |
| 120 | 120 |
| 121 ResponseOperation(this.converter, this.requestJson, this.responseJson) { | 121 ResponseOperation(this.converter, this.requestJson, this.responseJson) { |
| 122 completer.future.then(_processResult).timeout(responseTimeout); | 122 completer.future.then(_processResult).timeout(responseTimeout); |
| 123 } | 123 } |
| 124 | 124 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 subscription.cancel(); | 226 subscription.cancel(); |
| 227 timer.cancel(); | 227 timer.cancel(); |
| 228 String message = 'gave up waiting for analysis to complete'; | 228 String message = 'gave up waiting for analysis to complete'; |
| 229 driver.logger.log(Level.WARNING, message); | 229 driver.logger.log(Level.WARNING, message); |
| 230 completer.completeError(message); | 230 completer.completeError(message); |
| 231 } | 231 } |
| 232 }); | 232 }); |
| 233 return completer.future; | 233 return completer.future; |
| 234 } | 234 } |
| 235 } | 235 } |
| OLD | NEW |