Closed jonas-martinez closed 3 weeks ago
Just ignoring an error is never a good solution. If this problem only appear when the server restart, it's indeed not a big problem (since it only stops the GenServer, but we should check if the GenServer does something when it's stopped), you should at least add a log message with the warning level.
Well it is not really an error, if the user modifies his token for whatever reason should we consider this an error on Lenra ?
I don't think that a corrupted token should be treated as an error, we should just ask the user to log in again.
Note that this error occurs when a new oauth client is created and used and the user tries to connect with his oauth token from the old oauth client.
I will add a Logger.warning just in case, it will happen very rarely anyway so this will not spam the console.
@taorepoara I added the warning log as you asked.
About this PR
Closes https://github.com/lenra-io/server/issues/562
Technical highlight/advice
There was an issue with the Kubernetes.Status GenServer that could not be stopped because it did not exist. The stop method is called directly from Kubernetes with the CALLBACK_URL that is passed as a secret.
So Kubernetes calls the
runner/build/:id
API endpoint to update the build status. The server updates the status which is good and expected behaviour, it then tries to stop the Kubernetes.Status GenServer because it is not needed anymore. I don't really know why but this GenServer does not exist when the error occurs and it crashes the server.We just want to ignore the error when the GenServer does not exist because it means that we do not need to stop it as it is already stopped.
How to test my changes
I don't know how you can test my changes easily because you need to setup a kubernetes cluster on your computer.
Checklist
I included unit tests that cover my changes
I added/updated the documentation about my changes