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

Refactor Snapshot Service #404

Closed
LesnyRumcajs opened this issue Feb 13, 2024 · 2 comments
Closed

Refactor Snapshot Service #404

LesnyRumcajs opened this issue Feb 13, 2024 · 2 comments

Comments

@LesnyRumcajs
Copy link
Member

LesnyRumcajs commented Feb 13, 2024

I'll be honest, the setup for snapshot service is looking pretty confusing, a mix of ruby, bash and bash embedded into ruby. Perhaps we should improve upon this code? My eyes bleed reading this, it's not comprehensive at all. And we are talking about a really small amount of code.

If we want to keep using Ruby/Python or whatever else scripting language here - I think we should reconsider how bash is wrapped, and come up with somewhat clearer abstractions, e.g. an Object that has a bunch of methods that then do some bash stuff under the hood. It would be much nicer than interpolating a bunch of commands into a single string.

This stuff is looking pretty unreadable:

add_timestamps_cmd = <<~CMD
  awk '{
  if ($0 !~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6}Z/)
    print strftime("[%Y-%m-%d %H:%M:%S]"), $0;
  else
    print $0;
  fflush();
  }'
CMD

I appreciate the awk knowledge, but I'd prefer to have a readable alternative. If it's not easier and more comprehensive to do it in Ruby - at least some comments to avoid having to decipher this would be much appreciated.

All of that said, if it's too much effort to invest - it would at least be nice to have this code properly documented.

Originally posted by @ruseinov in #403 (comment)

@LesnyRumcajs
Copy link
Member Author

LesnyRumcajs commented Feb 13, 2024

@ruseinov Feel free to consult the new design (+ priority of implementing it) with the author of the service.

My two cents - this service worked well enough, regardless of its beauty, and is, to my understanding, going to be deprecated in favour of what Chainsafe Infrastructure is doing (@lemmih please correct me if I'm wrong) and so there's no point in any major refactoring.

@LesnyRumcajs
Copy link
Member Author

Forest snapshot service discontinued in favour of the infra snapshot service.

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