@@ -19,7 +19,6 @@ import '../../task/backend.dart';
19
19
import '../../tool/neat_task/pub_dev_tasks.dart' ;
20
20
21
21
import '../download_counts/backend.dart' ;
22
- import '_isolate.dart' ;
23
22
24
23
final Logger logger = Logger ('pub.analyzer' );
25
24
@@ -34,56 +33,20 @@ class AnalyzerCommand extends Command {
34
33
Future <void > run () async {
35
34
envConfig.checkServiceEnvironment (name);
36
35
await withServices (() async {
37
- final worker =
38
- await startWorkerIsolate (logger : logger, entryPoint : _workerMain );
39
- registerScopeExitCallback (worker.close );
36
+ await downloadCountsBackend. start ();
37
+ await taskBackend. start ( );
38
+ registerScopeExitCallback (() => taskBackend. stop () );
40
39
41
- final indexBuilder = await startWorkerIsolate (
42
- logger: logger,
43
- entryPoint: _indexBuilderMain,
44
- kind: 'index-builder' ,
45
- );
46
- registerScopeExitCallback (indexBuilder.close);
40
+ setupPeriodTaskSchedulers ();
41
+ // TODO: rewrite this loop to have a start/stop logic
42
+ scheduleMicrotask (searchBackend.updateSnapshotInForeverLoop);
47
43
48
44
if (activeConfiguration.exportedApiBucketName != null ) {
49
- final apiExporterIsolate = await startWorkerIsolate (
50
- logger: logger,
51
- entryPoint: _apiExporterMain,
52
- kind: 'api-exporter' ,
53
- );
54
- registerScopeExitCallback (apiExporterIsolate.close);
45
+ await apiExporter! .start ();
46
+ registerScopeExitCallback (() => apiExporter! .stop ());
55
47
}
56
48
57
49
await runHandler (logger, analyzerServiceHandler);
58
50
});
59
51
}
60
52
}
61
-
62
- Future _workerMain (EntryMessage message) async {
63
- message.protocolSendPort.send (ReadyMessage ());
64
-
65
- await downloadCountsBackend.start ();
66
- await taskBackend.start ();
67
- registerScopeExitCallback (() => taskBackend.stop ());
68
-
69
- setupPeriodTaskSchedulers ();
70
-
71
- // wait indefinitely
72
- await Completer ().future;
73
- }
74
-
75
- Future _indexBuilderMain (EntryMessage message) async {
76
- message.protocolSendPort.send (ReadyMessage ());
77
- await downloadCountsBackend.start ();
78
- await searchBackend.updateSnapshotInForeverLoop ();
79
- }
80
-
81
- Future _apiExporterMain (EntryMessage message) async {
82
- message.protocolSendPort.send (ReadyMessage ());
83
- await downloadCountsBackend.start ();
84
- await apiExporter! .start ();
85
- registerScopeExitCallback (() => apiExporter! .stop ());
86
-
87
- // wait indefinitely
88
- await Completer ().future;
89
- }
0 commit comments