[gnome-builder] libide/lsp: try harder to avoid spurious restarts
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/lsp: try harder to avoid spurious restarts
- Date: Fri, 30 Sep 2022 19:35:00 +0000 (UTC)
commit 95780fa90f9c13af76a4079495e387c0a0101b4e
Author: Christian Hergert <chergert redhat com>
Date: Fri Sep 30 12:34:49 2022 -0700
libide/lsp: try harder to avoid spurious restarts
We can get into a flurry of restarts while the pipeline is getting setup
and/or invalidated frequently.
src/libide/lsp/ide-lsp-service.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-service.c b/src/libide/lsp/ide-lsp-service.c
index c3f6dfee5..0a44f1052 100644
--- a/src/libide/lsp/ide-lsp-service.c
+++ b/src/libide/lsp/ide-lsp-service.c
@@ -622,19 +622,28 @@ static void
on_pipeline_loaded_cb (IdeLspService *self,
IdePipeline *pipeline)
{
+ IdeBuildManager *build_manager;
+ IdeContext *context;
+
IDE_ENTRY;
g_assert (IDE_IS_LSP_SERVICE (self));
g_assert (IDE_IS_PIPELINE (pipeline));
- g_signal_handlers_disconnect_by_func (pipeline,
- G_CALLBACK (on_pipeline_loaded_cb),
- self);
+ if (!(context = ide_object_get_context (IDE_OBJECT (self))) ||
+ !(build_manager = ide_build_manager_from_context (context)) ||
+ pipeline != ide_build_manager_get_pipeline (build_manager) ||
+ ide_pipeline_is_ready (pipeline))
+ g_signal_handlers_disconnect_by_func (pipeline,
+ G_CALLBACK (on_pipeline_loaded_cb),
+ self);
- g_debug ("Pipeline has completed loading, restarting LSP service %s",
- G_OBJECT_TYPE_NAME (self));
-
- ide_lsp_service_restart (self);
+ if (ide_pipeline_is_ready (pipeline))
+ {
+ g_debug ("Pipeline has completed loading, restarting LSP service %s",
+ G_OBJECT_TYPE_NAME (self));
+ ide_lsp_service_restart (self);
+ }
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]