Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions app/lib/services/services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ Future onStart(ServiceInstance service) async {
});

service.on('stop').listen((event) async {
if (recorder?.status != RecorderServiceStatus.stop) {
recorder?.stop();
try {
if (recorder?.status != RecorderServiceStatus.stop) {
recorder?.stop();
}
} catch (e) {
Logger.debug('Error stopping recorder during service stop: $e');
}
service.invoke("recorder.ui.stateUpdate", {"state": 'stopped'});
service.stopSelf();
Expand All @@ -141,8 +145,12 @@ Future onStart(ServiceInstance service) async {
Timer.periodic(const Duration(seconds: 5), (timer) async {
if (pongAt.isBefore(DateTime.now().subtract(const Duration(seconds: 15)))) {
// retire
if (recorder?.status != RecorderServiceStatus.stop) {
recorder?.stop();
try {
if (recorder?.status != RecorderServiceStatus.stop) {
recorder?.stop();
}
} catch (e) {
Logger.debug('Error stopping recorder during watchdog retire: $e');
}
service.invoke("recorder.ui.stateUpdate", {"state": 'stopped'});
service.stopSelf();
Expand Down