Bug 1721609: Don't wait for background Sentry VCS query to complete r=ahal
authorMitchell Hentges <mhentges@mozilla.com>
Tue, 19 Oct 2021 19:00:05 +0000
changeset 596384 3258547b4f42300bd02abace0b4b68f42dd9bef1
parent 596383 9d531fd67a5fd972472ba7b56e27e32d2fed0be5
child 596385 7eb79ae0c067d98d4ad6bdab882a6547663855d3
push id38896
push userabutkovits@mozilla.com
push dateTue, 19 Oct 2021 21:51:00 +0000
treeherdermozilla-central@e9071741b84c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1721609
milestone95.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1721609: Don't wait for background Sentry VCS query to complete r=ahal We do some VCS-status processing in the background so that, if an exception occurs, we already have the file-modification information we need to decide if Sentry should receive the event. This processing can take a few seconds, especially if on a feature branch with uncommitted changes. This patch resolves the case where the Mach command finishes extremely quickly, but the VCS check takes longer. Python waits for all non-daemon processes, so by marking it as a `daemon`, Python now exits immediately once the main thread completes. Differential Revision: https://phabricator.services.mozilla.com/D128806
python/mach/mach/sentry.py
--- a/python/mach/mach/sentry.py
+++ b/python/mach/mach/sentry.py
@@ -49,17 +49,19 @@ class NoopErrorReporter(ErrorReporter):
 
 
 def register_sentry(argv, settings, topsrcdir):
     if not is_telemetry_enabled(settings):
         return NoopErrorReporter()
 
     global _is_unmodified_mach_core_thread
     _is_unmodified_mach_core_thread = Thread(
-        target=_is_unmodified_mach_core, args=[topsrcdir]
+        target=_is_unmodified_mach_core,
+        args=[topsrcdir],
+        daemon=True,
     )
     _is_unmodified_mach_core_thread.start()
 
     sentry_sdk.init(
         _SENTRY_DSN, before_send=lambda event, _: _process_event(event, topsrcdir)
     )
     sentry_sdk.add_breadcrumb(message="./mach {}".format(" ".join(argv)))
     return SentryErrorReporter()