Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ideascube
ARCHIVED Kiwix Hotspot
Commits
ca5c2a97
Commit
ca5c2a97
authored
Sep 25, 2018
by
rgaudin
Browse files
Changed required disk space margin/rounding: use total space (incl. 5% margin for content) + 256MiB
parent
1d5d9fbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
kiwix-hotspot/backend/content.py
View file @
ca5c2a97
...
...
@@ -4,7 +4,6 @@
import
os
import
re
import
json
import
math
import
shutil
import
itertools
...
...
@@ -13,7 +12,7 @@ import requests
from
data
import
content_file
,
mirror
from
backend.catalog
import
YAML_CATALOGS
from
backend.download
import
get_content_cache
,
unarchive
from
util
import
get_temp_folder
,
get_checksum
,
ONE_GiB
,
ONE_
G
B
from
util
import
get_temp_folder
,
get_checksum
,
ONE_GiB
,
ONE_
Mi
B
# prepare CONTENTS from JSON file
with
open
(
content_file
,
"r"
)
as
fp
:
...
...
@@ -411,7 +410,8 @@ def get_expanded_size(collection):
for
item
in
get_all_contents_for
(
collection
)
]
)
margin
=
min
([
2
*
ONE_GiB
,
total_size
*
0.1
])
# add a 5% margin ; make sure it's at least 2GB
margin
=
min
([
2
*
ONE_GiB
,
total_size
*
0.05
])
return
total_size
+
margin
...
...
@@ -423,8 +423,7 @@ def get_required_image_size(collection):
]
)
# round it up to next GiB
return
math
.
ceil
(
required_size
/
ONE_GB
)
*
ONE_GB
return
required_size
+
ONE_MiB
*
256
# make sure we have some free space
def
get_required_building_space
(
collection
,
cache_folder
,
image_size
=
None
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment