독립 control plane 구성을 위해 기존 Dart CLI/runtime을 runner 앱 경계로 옮기고, 후속 client/core/root 작업을 같은 마일스톤 task group에 연결한다.
32 lines
No EOL
613 B
Dart
32 lines
No EOL
613 B
Dart
import 'package:oto/oto/data/command_data.dart';
|
|
|
|
class SchedulerInterval {
|
|
|
|
int interval;
|
|
bool activate = true;
|
|
bool progress = false;
|
|
DataBuild build;
|
|
|
|
Future Function(DataBuild build) executeFunc;
|
|
|
|
SchedulerInterval(this.interval, this.build, this.executeFunc) {
|
|
startInterval();
|
|
}
|
|
|
|
void startInterval() async {
|
|
while(activate) {
|
|
await Future.delayed(Duration(milliseconds: interval));
|
|
if(!progress) {
|
|
execute();
|
|
}
|
|
}
|
|
}
|
|
|
|
void execute() async {
|
|
if(activate) {
|
|
progress = true;
|
|
await executeFunc(build);
|
|
progress = false;
|
|
}
|
|
}
|
|
} |