"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
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
}
conn.vocabularyFileModTime = fi.ModTime()
conn.lastVocabularyError = nil
+ logger.Info("vocabulary file reloaded successfully")
}
return nil
}
func (conn *Conn) loadVocabularyFile() error {
vf, err := os.ReadFile(conn.cluster.API.VocabularyPath)
if err != nil {
- return fmt.Errorf("couldn't reading the vocabulary file: %v", err)
+ return fmt.Errorf("while reading the vocabulary file: %v", err)
}
mk := make([]string, 0, len(conn.cluster.Collections.ManagedProperties))
for k := range conn.cluster.Collections.ManagedProperties {
// 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
}
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
}