Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only restart key unit if keyfile has actually changed #174

Open
cprussin opened this issue Sep 16, 2023 · 1 comment
Open

Only restart key unit if keyfile has actually changed #174

cprussin opened this issue Sep 16, 2023 · 1 comment

Comments

@cprussin
Copy link
Contributor

This is perhaps a weaker but simpler optimization as #34.

Right now, when deploying with colmena, a whole bunch of services get restarted unnecessarily, because they depend on keyfiles and even though keys aren't changing, the keys are uploaded and so the systemd units for the keys are restarted (as are any units that depend on those).

#34 is probably quite challenging (but maybe there's a simple way to do it?) so I propose as a simpler solution let's just change

mv "$tmp" "$destination"
to:

if ! $(diff "$tmp" "$destination" > /dev/null); then
    mv "$tmp" "$destination"
else
    rm "$tmp"
fi

That may not prevent the network overhead of transferring unchanged keys, but at least it will prevent the unnecessary service restarts, and it's presumably much simpler than #34 .

Thoughts @zhaofengli ? If I put in a PR with this change would you accept it?

@cprussin
Copy link
Contributor Author

hey @zhaofengli 👋 friendly nudge here, if you just tell me this is something you'd be willing to accept I'd be happy to put in a PR for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant