Fix race condition in alert service
This commit is contained in:
parent
437dee288e
commit
f0a2307517
1 changed files with 24 additions and 22 deletions
|
@ -79,9 +79,11 @@ public class InsightAlertService extends Service implements InsightConnectionSer
|
|||
}
|
||||
|
||||
public void ignore(AlertType alertType) {
|
||||
synchronized ($alertLock) {
|
||||
ignoreTimestamp = System.currentTimeMillis();
|
||||
ignoreType = alertType;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -132,7 +134,6 @@ public class InsightAlertService extends Service implements InsightConnectionSer
|
|||
if (alertActivity != null && alert != null)
|
||||
new Handler(Looper.getMainLooper()).post(() -> alertActivity.update(alert));
|
||||
}
|
||||
}
|
||||
if (alert == null) {
|
||||
stopAlerting();
|
||||
if (connectionRequested) {
|
||||
|
@ -154,6 +155,7 @@ public class InsightAlertService extends Service implements InsightConnectionSer
|
|||
new Handler(Looper.getMainLooper()).post(() -> startActivity(intent));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ignored) {
|
||||
connectionService.withdrawConnectionRequest(thread);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue