From 7c61e9662ed1c9a2079575405035b7dcabe1a6d1 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 18 Jun 2020 11:08:26 +0800 Subject: [PATCH] informer: do not inform if backend not init --- pkg/cloudcommon/db/tablespec.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cloudcommon/db/tablespec.go b/pkg/cloudcommon/db/tablespec.go index ab14dc2c81..dd52edd23a 100644 --- a/pkg/cloudcommon/db/tablespec.go +++ b/pkg/cloudcommon/db/tablespec.go @@ -129,6 +129,9 @@ func (ts *sTableSpec) Update(ctx context.Context, dt interface{}, doUpdate func( } func (ts *sTableSpec) inform(ctx context.Context, dt interface{}, f func(ctx context.Context, obj *informer.ModelObject) error) { + if !informer.IsInit() { + return + } nf := func() { obj, err := ts.newInformerModel(dt) if err != nil { @@ -147,6 +150,9 @@ func (ts *sTableSpec) inform(ctx context.Context, dt interface{}, f func(ctx con } func (ts *sTableSpec) informUpdate(ctx context.Context, dt interface{}, oldObj *jsonutils.JSONDict) { + if !informer.IsInit() { + return + } nf := func() { obj, err := ts.newInformerModel(dt) if err != nil {