-
Notifications
You must be signed in to change notification settings - Fork 84
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
Speed up rm bundles #4312
Speed up rm bundles #4312
Changes from 14 commits
f092646
5847974
c1347f7
ad40d6a
c4d53e3
a7c4b23
8cadd5a
d3b1946
10468b0
9d37ca7
8065d78
fc0dc05
7301ed7
5da242e
c637062
cec09e6
849a580
681bd8e
503b757
a88bef8
e82f54f
4f85cd6
895feca
f47f4c9
2ed46bf
f700ac0
efd2956
6d1984e
783b431
8b64d42
f30bf4a
e24b47b
3cf2bdf
96a5852
7db87ba
cc8d352
00cdaf7
81a42f5
e3ae1cd
c217119
bb30ccb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,20 +310,24 @@ def remove(path): | |
|
||
if not FileSystems.exists(path): | ||
FileSystems.delete([path]) | ||
return | ||
return True # not sure about this one | ||
check_isvalid(path, 'remove') | ||
set_write_permissions(path) # Allow permissions | ||
if os.path.islink(path): | ||
os.unlink(path) | ||
return False | ||
elif os.path.isdir(path): | ||
try: | ||
shutil.rmtree(path) | ||
return True | ||
except shutil.Error: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is an error, it will have no return value here? Should we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! I added a return False statement at the end of the function to catch any other cases. |
||
pass | ||
else: | ||
os.remove(path) | ||
return True | ||
if os.path.exists(path): | ||
print('Failed to remove %s' % path) | ||
return False | ||
|
||
|
||
def soft_link(source, path): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2708,6 +2708,14 @@ def increment_user_time_used(self, user_id, amount): | |
user_info['time_used'] += amount | ||
self.update_user_info(user_info) | ||
|
||
def increment_user_disk_used(self, user_id, amount): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add type hints. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
""" | ||
User used some time. | ||
""" | ||
user_info = self.get_user_info(user_id) | ||
user_info['disk_used'] += amount | ||
self.update_user_info(user_info) | ||
|
||
def get_user_time_quota_left(self, user_id, user_info=None): | ||
if not user_info: | ||
user_info = self.get_user_info(user_id) | ||
|
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.
return True
look good to me