defensive code around accounts init
This commit is contained in:
@@ -60,22 +60,22 @@ func New(opts ...Option) (s *Service, err error) {
|
|||||||
retries := 20
|
retries := 20
|
||||||
var current int
|
var current int
|
||||||
r := oreg.GetRegistry()
|
r := oreg.GetRegistry()
|
||||||
// TODO(refs) we only need to block here IF the accounts index is configured to use the CS3 index. This is because
|
if cfg.Repo.Disk.Path == "" {
|
||||||
// the cs3 implementation relies on a storage-metadata backend that runs as a reva service.
|
for {
|
||||||
for {
|
if current >= retries {
|
||||||
if current >= retries {
|
panic("metadata service failed to start.")
|
||||||
panic("metadata service failed to start.")
|
}
|
||||||
|
s, err := r.GetService("com.owncloud.storage.metadata")
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Err(err).Msg("error getting metadata service from service registry")
|
||||||
|
}
|
||||||
|
if len(s) > 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
logger.Info().Msg("accounts blocked waiting for metadata service to be up and running...")
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
current++
|
||||||
}
|
}
|
||||||
s, err := r.GetService("com.owncloud.storage.metadata")
|
|
||||||
if err != nil {
|
|
||||||
logger.Error().Err(err).Msg("error getting metadata service from service registry")
|
|
||||||
}
|
|
||||||
if len(s) > 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
logger.Info().Msg("accounts blocked waiting for metadata service to be up and running...")
|
|
||||||
time.Sleep(2 * time.Second)
|
|
||||||
current++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we want to wait anyway. If it depends on a reva service it could be the case that the entry on the registry
|
// we want to wait anyway. If it depends on a reva service it could be the case that the entry on the registry
|
||||||
|
|||||||
Reference in New Issue
Block a user