From a1044c1afc3fe4d96010a118afc5ec9b0fd09f8f Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Tue, 20 Apr 2021 17:55:33 +0800 Subject: [PATCH] procutils: add WaitZombieLoop --- pkg/ansibleserver/service/service.go | 3 ++- pkg/{ansibleserver/service => util/procutils}/zombie.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename pkg/{ansibleserver/service => util/procutils}/zombie.go (97%) diff --git a/pkg/ansibleserver/service/service.go b/pkg/ansibleserver/service/service.go index 67c89c615f..3901aa1811 100644 --- a/pkg/ansibleserver/service/service.go +++ b/pkg/ansibleserver/service/service.go @@ -28,6 +28,7 @@ import ( common_app "yunion.io/x/onecloud/pkg/cloudcommon/app" "yunion.io/x/onecloud/pkg/cloudcommon/db" common_options "yunion.io/x/onecloud/pkg/cloudcommon/options" + "yunion.io/x/onecloud/pkg/util/procutils" ) func StartService() { @@ -49,7 +50,7 @@ func StartService() { db.EnsureAppInitSyncDB(app, dbOpts, models.InitDB) defer cloudcommon.CloseDB() - go ReapZomebieLoop(context.TODO()) + go procutils.WaitZombieLoop(context.TODO()) common_app.ServeForever(app, baseOpts) } diff --git a/pkg/ansibleserver/service/zombie.go b/pkg/util/procutils/zombie.go similarity index 97% rename from pkg/ansibleserver/service/zombie.go rename to pkg/util/procutils/zombie.go index 224e054df6..7127c09a9d 100644 --- a/pkg/ansibleserver/service/zombie.go +++ b/pkg/util/procutils/zombie.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package service +package procutils import ( "context" @@ -28,7 +28,7 @@ import ( "yunion.io/x/log" ) -func ReapZomebieLoop(ctx context.Context) { +func WaitZombieLoop(ctx context.Context) { myPid := os.Getpid() if myPid != 1 { log.Infof("My pid is not 1 and no need to wait zombies")