Skip to content

Commit 1f4cafd

Browse files
committed
Refactor initial housekeeping triggering
1 parent fefd117 commit 1f4cafd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationBackgroundThread.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
public class UnityNotificationBackgroundThread extends Thread {
99
private LinkedTransferQueue<Runnable> mTasks = new LinkedTransferQueue();
1010

11+
public UnityNotificationBackgroundThread() {
12+
enqueueHousekeeping();
13+
}
14+
1115
public void enqueueTask(Runnable task) {
1216
mTasks.add(task);
1317
}
1418

19+
public void enqueueHousekeeping() {
20+
mTasks.add(() -> { performHousekeeping(); });
21+
}
22+
1523
@Override
1624
public void run() {
17-
performHousekeeping();
18-
1925
while (true) {
2026
try {
2127
Runnable task = mTasks.take();

0 commit comments

Comments
 (0)