-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Web UI: Upload to tmp file name then rename if successful #1272
Conversation
b354733
to
70c7184
Compare
70c7184
to
c9468a1
Compare
try: | ||
archive_info = self._get_archive_info( | ||
f"{server_info['image_dir']}/{file.name}", | ||
_cache_extra_key=file.size, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I remember what this is for now, which was a somewhat brittle cache invalidator for when a file is replaced with another of the same name. Otherwise, we'll return the previous file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! I was confused because _cache_extra_key wasn't actually called in our code. So I assume it's used by the cache library behind the scenes then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored those two lines
c9468a1
to
bed15f6
Compare
@@ -41,18 +37,8 @@ class FileCmds: | |||
class for methods reading from and writing to the file system | |||
""" | |||
|
|||
def __init__(self, sock_cmd: SocketCmds, piscsi: PiscsiCmds, token=None, locale=None): | |||
self.sock_cmd = sock_cmd | |||
def __init__(self, piscsi: PiscsiCmds): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nucleogenic Question! What do you think about not initializing the class with the PiscsiCmds object? The original motivation was for sharing the token and locale, I believe. But now when FileCmds doesn't access the protobuf interface anymore it's not really needed, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind; I gave it a go and quickly realized that instantiating a new PiscsiCmds object is a pain.
Additionally, in order to simplify access to the file commands class in the file upload function, refactoring associated code to: