fix: Models disconnecting from etcd3 #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current code structure as Mathias recommended is modular, with an API frontend server and various docker containers with the models as the backend. The frontend server acts as a lister of the models available on the backend. All of this is orchestrated through an
etcd3database, a key-value db where entries have a lifetime and after the lifetime expires the records are removed. This permits us integrating new models without having to redeploy everything. In this case, for a reason that I don't fully understand, the lease renewal fails at some point in the lifetime. This causes the frontend to no longer recognize models' existence. I have made two main changes with this PR:a) I have added better logging to spot what could be going wrong if it happens again.
b) I have added a lot of code around the lease renewal so that retries are performed if the execution fails + the client session is recreated to hopefully be able to interact with the database.