Skip to content

Conversation

@CDRussell
Copy link
Member

@CDRussell CDRussell commented Nov 12, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/608920331025315/task/1211922784726284?focus=true

Description

Moves work which can trigger IO to an io dispatcher instead of main and Default dispatchers that can be used currently.

Steps to test this PR

Add logcat filter: unsent clear data pixels|Pixel sent: ml|Pixel sent: mf

ml pixel

  • Launch the app; verify you see ml pixel sent
  • Switch to another app, then switch back to our app (it's not always enough just to background it and return). verify you see the ml pixel sent

mf pixel

  • Apply patch (which triggers the background worker to run immediately on app launch instead of waiting for it to run after a few hours); install and launch app
  • Use the fire button a few times (n times) to clear data
  • Switch to another app, then switch back to ours; verify you see Found n unsent clear data pixels and n instances of Pixel sent: mf

Patch

Index: app/src/main/java/com/duckduckgo/app/pixels/EnqueuedPixelWorker.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/com/duckduckgo/app/pixels/EnqueuedPixelWorker.kt b/app/src/main/java/com/duckduckgo/app/pixels/EnqueuedPixelWorker.kt
--- a/app/src/main/java/com/duckduckgo/app/pixels/EnqueuedPixelWorker.kt	(revision Staged)
+++ b/app/src/main/java/com/duckduckgo/app/pixels/EnqueuedPixelWorker.kt	(date 1762956896767)
@@ -86,6 +86,9 @@
             return
         }
 
+        val oneTimeRequest = OneTimeWorkRequestBuilder<RealEnqueuedPixelWorker>().build()
+        workManager.beginUniqueWork("pixel_sender", ExistingWorkPolicy.REPLACE, oneTimeRequest).enqueue()
+
         appCoroutineScope.launch(dispatchers.io()) {
             sendAppLaunchPixel()
         }

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CDRussell CDRussell marked this pull request as ready for review November 12, 2025 14:35
}

@Test
fun whenOnStartAndVerifiedAppLaunchThenSendVerifiedAppLaunchPixel() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filling a gap in testing while i'm in here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants