mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-15 17:55:15 -10:00
Bug 1900928 - Disable suggest reingestion. r=lina,android-reviewers,jonalmeida
- Don't schedule WorkManager task and cancel any in-progress tasks - Make FxSuggestIngestionWorker.doWork a no-op. This will make it so any previously scheduled tasks that run at startup don't do anything. - Remove the secret debug menu item for this, since it will no longer have any effect. Differential Revision: https://phabricator.services.mozilla.com/D212758
This commit is contained in:
1 parent
d8dd5c4d76
commit
142676088f
6 files changed
+17
-58
No files matched your search
+4
-10
@@ -22,16 +22,10 @@ internal class FxSuggestIngestionWorker(
|
||||
private val logger = Logger("FxSuggestIngestionWorker")
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
logger.info("Ingesting new suggestions")
|
||||
val storage = GlobalFxSuggestDependencyProvider.requireStorage()
|
||||
val success = storage.ingest()
|
||||
return if (success) {
|
||||
logger.info("Successfully ingested new suggestions")
|
||||
Result.success()
|
||||
} else {
|
||||
logger.error("Failed to ingest new suggestions")
|
||||
Result.retry()
|
||||
}
|
||||
// Disable periodic ingestion until we figure out
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1900837
|
||||
logger.info("Skipping ingesting new suggestions")
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+4
-13
@@ -18,6 +18,7 @@ import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mockito.never
|
||||
import org.mockito.Mockito.verify
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@@ -43,19 +44,9 @@ class FxSuggestIngestionWorkerTest {
|
||||
|
||||
val result = worker.startWork().await()
|
||||
|
||||
verify(storage).ingest(any())
|
||||
// Ingestion is disabled until we figure out
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1900837
|
||||
verify(storage, never()).ingest(any())
|
||||
assertEquals(ListenableWorker.Result.success(), result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun workShouldRetry() = runTest {
|
||||
whenever(storage.ingest(any())).thenReturn(false)
|
||||
|
||||
val worker = TestListenableWorkerBuilder<FxSuggestIngestionWorker>(testContext).build()
|
||||
|
||||
val result = worker.startWork().await()
|
||||
|
||||
verify(storage).ingest(any())
|
||||
assertEquals(ListenableWorker.Result.retry(), result)
|
||||
}
|
||||
}
|
||||
@@ -380,11 +380,15 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
|
||||
// new search suggestions. The worker requires us to have called
|
||||
// `GlobalFxSuggestDependencyProvider.initialize`, which we did before
|
||||
// scheduling these tasks. When disabled we stop the periodic work.
|
||||
if (settings().enableFxSuggest) {
|
||||
components.fxSuggest.ingestionScheduler.startPeriodicIngestion()
|
||||
} else {
|
||||
components.fxSuggest.ingestionScheduler.stopPeriodicIngestion()
|
||||
}
|
||||
|
||||
// Disable periodic ingestion until we figure out
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1900837
|
||||
//
|
||||
// Note: we will still ingest once for a fresh DB because of
|
||||
// the `runStartupIngestion()` call below. This should be okay, the
|
||||
// performance issues only happen when reingesting after a successful
|
||||
// initial ingestion.
|
||||
components.fxSuggest.ingestionScheduler.stopPeriodicIngestion()
|
||||
}
|
||||
components.core.fileUploadsDirCleaner.cleanUploadsDirectory()
|
||||
}
|
||||
|
||||
-23
@@ -5,7 +5,6 @@
|
||||
package org.mozilla.fenix.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.core.content.edit
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.preference.EditTextPreference
|
||||
@@ -16,7 +15,6 @@ import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.debugsettings.data.DefaultDebugSettingsRepository
|
||||
import org.mozilla.fenix.ext.components
|
||||
@@ -88,27 +86,6 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
|
||||
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||
}
|
||||
|
||||
requirePreference<SwitchPreference>(R.string.pref_key_enable_fxsuggest).apply {
|
||||
isVisible = FeatureFlags.fxSuggest
|
||||
isChecked = context.settings().enableFxSuggest
|
||||
onPreferenceChangeListener = object : Preference.OnPreferenceChangeListener {
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||
val newBooleanValue = newValue as? Boolean ?: return false
|
||||
val ingestionScheduler =
|
||||
requireContext().components.fxSuggest.ingestionScheduler
|
||||
if (newBooleanValue) {
|
||||
ingestionScheduler.startPeriodicIngestion()
|
||||
} else {
|
||||
ingestionScheduler.stopPeriodicIngestion()
|
||||
}
|
||||
requireContext().settings().preferences.edit {
|
||||
putBoolean(preference.key, newBooleanValue)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
requirePreference<SwitchPreference>(R.string.pref_key_should_enable_felt_privacy).apply {
|
||||
isVisible = true
|
||||
isChecked = context.settings().feltPrivateBrowsingEnabled
|
||||
|
||||
@@ -80,8 +80,6 @@
|
||||
<string name="preferences_debug_settings_compose_homepage" translatable="false">Enable Compose Homepage</string>
|
||||
<!-- Label for enabling the menu redesign -->
|
||||
<string name="preferences_debug_settings_menu_redesign" translatable="false">Enable Menu Redesign</string>
|
||||
<!-- Label for enabling Firefox Suggest -->
|
||||
<string name="preferences_debug_settings_fxsuggest" translatable="false">Enable Firefox Suggest</string>
|
||||
<!-- Label for enabling Toolbar Redesign incomplete portions -->
|
||||
<string name="preferences_debug_settings_toolbar_redesign" translatable="false">Enable Toolbar Redesign incomplete portions</string>
|
||||
<!-- Label for enabling Felt Privacy -->
|
||||
|
||||
@@ -40,11 +40,6 @@
|
||||
android:key="@string/pref_key_toolbar_use_redesign_incomplete"
|
||||
android:title="@string/preferences_debug_settings_toolbar_redesign"
|
||||
app:iconSpaceReserved="false" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key_enable_fxsuggest"
|
||||
android:title="@string/preferences_debug_settings_fxsuggest"
|
||||
app:iconSpaceReserved="false" />
|
||||
<SwitchPreference
|
||||
android:key="@string/pref_key_should_enable_felt_privacy"
|
||||
app:iconSpaceReserved="false"
|
||||
|
||||
Reference in new issue
Block a user