| 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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 }); | 215 }); |
| 216 timer = new Timer.periodic(new Duration(milliseconds: 20), (_) { | 216 timer = new Timer.periodic(new Duration(milliseconds: 20), (_) { |
| 217 if (!isAnalyzing) { | 217 if (!isAnalyzing) { |
| 218 // TODO (danrubel) revisit this once source change requests are implemen
ted | 218 // TODO (danrubel) revisit this once source change requests are implemen
ted |
| 219 subscription.cancel(); | 219 subscription.cancel(); |
| 220 timer.cancel(); | 220 timer.cancel(); |
| 221 driver.logger.log(Level.INFO, 'analysis never started'); | 221 driver.logger.log(Level.INFO, 'analysis never started'); |
| 222 completer.complete(); | 222 completer.complete(); |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 // Timeout if no communcation received within the last 60 seconds. | 225 // Timeout if no communication received within the last 60 seconds. |
| 226 double currentTime = driver.server.currentElapseTime; | 226 double currentTime = driver.server.currentElapseTime; |
| 227 double lastTime = driver.server.lastCommunicationTime; | 227 double lastTime = driver.server.lastCommunicationTime; |
| 228 if (currentTime - lastTime > 60) { | 228 if (currentTime - lastTime > 60) { |
| 229 subscription.cancel(); | 229 subscription.cancel(); |
| 230 timer.cancel(); | 230 timer.cancel(); |
| 231 String message = 'gave up waiting for analysis to complete'; | 231 String message = 'gave up waiting for analysis to complete'; |
| 232 driver.logger.log(Level.WARNING, message); | 232 driver.logger.log(Level.WARNING, message); |
| 233 completer.completeError(message); | 233 completer.completeError(message); |
| 234 } | 234 } |
| 235 }); | 235 }); |
| 236 return completer.future; | 236 return completer.future; |
| 237 } | 237 } |
| 238 } | 238 } |
| OLD | NEW |