mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-15 05:47:36 +00:00
refactor: performance improvements in batch message processing, synchronized cache access and audible message notifications.
Increase audible timeout on DefaultMessageNotifier.java, don't send in-thread notification based on last audible notification. Create a batch message receive job to handle up to 20 chunked messages at a time per job instead of singular or open group poll amount Remove synchronized access to recipient cache and replace with a concurrent cache that's lock free from perf tracing monitor contention
This commit is contained in:
@@ -97,7 +97,7 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||
private static final int SUMMARY_NOTIFICATION_ID = 1338;
|
||||
private static final int PENDING_MESSAGES_ID = 1111;
|
||||
private static final String NOTIFICATION_GROUP = "messages";
|
||||
private static final long MIN_AUDIBLE_PERIOD_MILLIS = TimeUnit.SECONDS.toMillis(2);
|
||||
private static final long MIN_AUDIBLE_PERIOD_MILLIS = TimeUnit.SECONDS.toMillis(5);
|
||||
private static final long DESKTOP_ACTIVITY_PERIOD = TimeUnit.MINUTES.toMillis(1);
|
||||
|
||||
private volatile static long visibleThread = -1;
|
||||
@@ -440,9 +440,12 @@ public class DefaultMessageNotifier implements MessageNotifier {
|
||||
|
||||
private void sendInThreadNotification(Context context, Recipient recipient) {
|
||||
if (!TextSecurePreferences.isInThreadNotifications(context) ||
|
||||
ServiceUtil.getAudioManager(context).getRingerMode() != AudioManager.RINGER_MODE_NORMAL)
|
||||
ServiceUtil.getAudioManager(context).getRingerMode() != AudioManager.RINGER_MODE_NORMAL ||
|
||||
(System.currentTimeMillis() - lastAudibleNotification) < MIN_AUDIBLE_PERIOD_MILLIS)
|
||||
{
|
||||
return;
|
||||
} else {
|
||||
lastAudibleNotification = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
Uri uri = null;
|
||||
|
Reference in New Issue
Block a user