!49 修复dde-daemon重复使能模块的问题

From: @kkzhs_admin 
Reviewed-by: @leeffo 
Signed-off-by: @leeffo
This commit is contained in:
openeuler-ci-bot 2023-07-21 05:18:56 +00:00 committed by Gitee
commit 4f21de23ca
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 64 additions and 1 deletions

View File

@ -12,7 +12,7 @@
Name: dde-daemon
Version: 5.13.85.8
Release: 3
Release: 4
Summary: Daemon handling the DDE session settings
License: GPLv3
URL: http://shuttle.corp.deepin.com/cache/tasks/18802/unstable-amd64/
@ -20,6 +20,7 @@ Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: %{sname}.sysusers
#Patch1: 0001-Fix-the-system-monitor-displaying-a-scene.patch
Patch1: fix-the-issue-enabling-module-repeatly.patch
BuildRequires: python3
BuildRequires: golang
@ -188,6 +189,9 @@ fi
/etc/lightdm/deepin/xsettingsd.conf
%changelog
* Fri Jul 21 2023 zhaoshuang <zhaoshuang@uniontech.com> - 5.13.85.8-4
- fix: fix the issue enabling module repeatly
* Wed May 31 2023 hanshuang <hanshuang@uniontech.com> - 5.13.85.8-3
- fix: install start problem

View File

@ -0,0 +1,59 @@
From cbc116c79d0783fa7e280b15758fd19fe2a06d67 Mon Sep 17 00:00:00 2001
From: kkz <zhaoshuang@uniontech.com>
Date: Fri, 21 Jul 2023 11:18:50 +0800
Subject: [PATCH] fix: fix the issue enabling module repeatly
---
loader/loader.go | 10 ++++++++++
loader/module.go | 7 ++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/loader/loader.go b/loader/loader.go
index d218ab6..b34e9e8 100644
--- a/loader/loader.go
+++ b/loader/loader.go
@@ -164,6 +164,11 @@ func (l *Loader) EnableModules(enablingModules []string, disableModules []string
go func() {
l.log.Info("enable module", name)
+ if module.IsEnable() == true {
+ l.log.Infof("module %s has been enabled", name)
+ return;
+ }
+
startTime := time.Now()
// wait for its dependency
@@ -185,6 +190,11 @@ func (l *Loader) EnableModules(enablingModules []string, disableModules []string
for _, n := range nodes {
m := l.modules[n.ID]
+
+ if m.IsEnable() == true {
+ continue;
+ }
+
m.WaitEnable()
}
diff --git a/loader/module.go b/loader/module.go
index 325a572..b4320db 100644
--- a/loader/module.go
+++ b/loader/module.go
@@ -54,9 +54,10 @@ type ModuleBase struct {
func NewModuleBase(name string, impl ModuleImpl, logger *log.Logger) *ModuleBase {
m := &ModuleBase{
- name: name,
- impl: impl,
- log: logger,
+ name: name,
+ impl: impl,
+ log: logger,
+ enabled:false,
}
// 此为等待「enabled」的 WaitGroup故在 enable 完成之前,需要一直为等待状态。
--
2.27.0