Open jvillafanez opened 10 months ago
Log should appear only when the service is actually registered.
We use a ttl on the registry, so services need to register periodically. So this log means the service has actually (re-) registered. However I'd be fine with only logging in error case
Removing the log seems to be the easiest option.
Alternative 1 could be to check whether the service it already registered, but since we have to re-register the service anyway to update the ttl, we'd be checking just to show the log, so it's likely a big waste.
Alternative 2 could be to implement a specific method to update the ttl and / or register, something like UpdateTTLOrRegister(...)
so the method could return additional information, not just the error. This doesn't seem a short term plan though.
Describe the bug
Periodic debug logs appears without doing anything.
Steps to reproduce
Expected behavior
Log should appear only when the service is actually registered. If the service is already there, re-registering is meaningless and shouldn't happen, and the log shouldn't appear
Actual behavior
Periodic actions shouldn't log meaningless things to avoid flooding the logs, specially if there is no user interaction.
Setup
Please describe how you started the server and provide a list of relevant environment variables or configuration files.
```console OCIS_LOG_LEVEL=debug ```
Additional context
Log comes from https://github.com/owncloud/ocis/blob/c9a77eb43f1f2d4591c9b8920396437b758ad624/ocis-pkg/registry/register.go#L30
Taking into account that the log happens on a timer in a different thread, it makes sense to check whether the service is already in the registry. If the service isn't registered, or has been unregistered, write a debug log when the service is successfully registered.
We could also remove that log. We already have a log when the service is registered the first time, which shouldn't give any problems. There are logs when the registration fails, including the timed re-registration, so we can assume that there is no problem if no log happens. Therefore, the "refreshing registration" log is redundant and can be removed.