X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/36b4a526be01a76eeb2ef2db645598f45f1de992..bc3637c90f8e4e3d1bdc61546c3d7fc53da135f6:/lib/controller/localdb/conn.go diff --git a/lib/controller/localdb/conn.go b/lib/controller/localdb/conn.go index f515673154..323e660c6f 100644 --- a/lib/controller/localdb/conn.go +++ b/lib/controller/localdb/conn.go @@ -18,6 +18,7 @@ import ( "git.arvados.org/arvados.git/sdk/go/arvados" "git.arvados.org/arvados.git/sdk/go/ctxlog" "git.arvados.org/arvados.git/sdk/go/httpserver" + "github.com/sirupsen/logrus" ) type railsProxy = rpc.Conn @@ -70,7 +71,7 @@ func (conn *Conn) checkProperties(ctx context.Context, properties interface{}) e return nil } -func (conn *Conn) maybeRefreshVocabularyCache() error { +func (conn *Conn) maybeRefreshVocabularyCache(logger logrus.FieldLogger) error { if conn.lastVocabularyRefreshCheck.Add(time.Second).After(time.Now()) { // Throttle the access to disk to at most once per second. return nil @@ -90,6 +91,7 @@ func (conn *Conn) maybeRefreshVocabularyCache() error { } conn.vocabularyFileModTime = fi.ModTime() conn.lastVocabularyError = nil + logger.Info("vocabulary file reloaded successfully") } return nil } @@ -107,18 +109,15 @@ func (conn *Conn) loadVocabularyFile() error { if err != nil { return fmt.Errorf("while loading vocabulary file %q: %s", conn.cluster.API.VocabularyPath, err) } - err = voc.Validate() - if err != nil { - return fmt.Errorf("while validating vocabulary file %q: %s", conn.cluster.API.VocabularyPath, err) - } conn.vocabularyCache = voc return nil } // LastVocabularyError returns the last error encountered while loading the // vocabulary file. +// Implements health.Func func (conn *Conn) LastVocabularyError() error { - conn.maybeRefreshVocabularyCache() + conn.maybeRefreshVocabularyCache(ctxlog.FromContext(context.Background())) return conn.lastVocabularyError } @@ -138,11 +137,9 @@ func (conn *Conn) VocabularyGet(ctx context.Context) (arvados.Vocabulary, error) return arvados.Vocabulary{}, err } } - err := conn.maybeRefreshVocabularyCache() + err := conn.maybeRefreshVocabularyCache(logger) if err != nil { logger.WithError(err).Error("error reloading vocabulary file - ignoring") - } else { - logger.Info("vocabulary file reloaded successfully") } return *conn.vocabularyCache, nil }