Skip to content

Commit

Permalink
Adjust size of max_download_dir_size and max_upload_size (#739)
Browse files Browse the repository at this point in the history
* Adjust size of max_download_dir_size and max_upload_size

* Update ci python

---------

Co-authored-by: 杨赫然 <[email protected]>
  • Loading branch information
feiniks and 杨赫然 authored Feb 26, 2025
1 parent 4181851 commit d5fa18f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fetch-depth: 1
- uses: actions/setup-python@v1
with:
python-version: "3.12.8"
python-version: "3.12.9"
- name: install dependencies and test
run: |
cd $GITHUB_WORKSPACE
Expand Down
2 changes: 1 addition & 1 deletion ci/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _env_add(*a, **kw):

_env_add('PATH', join(PREFIX, 'bin'))
if on_github_actions():
_env_add('PYTHONPATH', join(os.environ.get('RUNNER_TOOL_CACHE'), 'Python/3.12.8/x64/lib/python3.12/site-packages'))
_env_add('PYTHONPATH', join(os.environ.get('RUNNER_TOOL_CACHE'), 'Python/3.12.9/x64/lib/python3.12/site-packages'))
_env_add('PYTHONPATH', join(PREFIX, 'lib/python3.12/site-packages'))
_env_add('PKG_CONFIG_PATH', join(PREFIX, 'lib', 'pkgconfig'))
_env_add('PKG_CONFIG_PATH', join(PREFIX, 'lib64', 'pkgconfig'))
Expand Down
4 changes: 1 addition & 3 deletions fileserver/option/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var (
Host string
Port uint32
MaxUploadSize uint64
MaxDownloadDirSize uint64
FsIdListRequestTimeout int64
// Block size for indexing uploaded files
FixedBlockSize uint64
Expand Down Expand Up @@ -73,7 +72,6 @@ var (
func initDefaultOptions() {
Host = "0.0.0.0"
Port = 8082
MaxDownloadDirSize = 100 * (1 << 20)
FixedBlockSize = 1 << 23
MaxIndexingThreads = 1
WebTokenExpireTime = 7200
Expand Down Expand Up @@ -161,7 +159,7 @@ func parseFileServerSection(section *ini.Section) {
if key, err := section.GetKey("max_upload_size"); err == nil {
size, err := key.Uint()
if err == nil {
MaxUploadSize = uint64(size) * (1 << 20)
MaxUploadSize = uint64(size) * 1000000
}
}
if key, err := section.GetKey("max_indexing_threads"); err == nil {
Expand Down
6 changes: 3 additions & 3 deletions python/seaserv/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ def get_fileserver_option(key, default):
try:
max_upload_size_mb = int(get_fileserver_option('max_upload_size', 0))
if max_upload_size_mb > 0:
MAX_UPLOAD_FILE_SIZE = max_upload_size_mb * (2 ** 20)
MAX_UPLOAD_FILE_SIZE = max_upload_size_mb * 1000000
except ValueError:
pass

MAX_DOWNLOAD_DIR_SIZE = 100 * (2 ** 20) # Default max size of a downloadable dir
MAX_DOWNLOAD_DIR_SIZE = 100 * 1000000 # Default max size of a downloadable dir
try:
max_download_dir_size_mb = int(get_fileserver_option('max_download_dir_size', 0))
if max_download_dir_size_mb > 0:
MAX_DOWNLOAD_DIR_SIZE = max_download_dir_size_mb * (2 ** 20)
MAX_DOWNLOAD_DIR_SIZE = max_download_dir_size_mb * 1000000
except ValueError:
pass

Expand Down
2 changes: 1 addition & 1 deletion server/upload-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ check_tmp_file_list (GList *tmp_files, int *error_code)
max_upload_size = seaf_cfg_manager_get_config_int64 (seaf->cfg_mgr, "fileserver",
"max_upload_size");
if (max_upload_size > 0)
max_upload_size = max_upload_size * ((gint64)1 << 20);
max_upload_size = max_upload_size * 1000000;
else
max_upload_size = -1;

Expand Down
4 changes: 2 additions & 2 deletions server/zip-download-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define MAX_ZIP_THREAD_NUM 5
#define SCAN_PROGRESS_INTERVAL 24 * 3600 // 1 day
#define PROGRESS_TTL 5 * 3600 // 5 hours
#define DEFAULT_MAX_DOWNLOAD_DIR_SIZE 100 * ((gint64)1 << 20) /* 100MB */
#define DEFAULT_MAX_DOWNLOAD_DIR_SIZE 100 * 1000000 /* 100MB */

typedef struct ZipDownloadMgrPriv {
pthread_mutex_t progress_lock;
Expand Down Expand Up @@ -471,7 +471,7 @@ validate_download_size (DownloadObj *obj, GError **error)
max_download_dir_size = seaf_cfg_manager_get_config_int64 (seaf->cfg_mgr, "fileserver",
"max_download_dir_size");
if (max_download_dir_size > 0)
max_download_dir_size = max_download_dir_size * ((gint64)1 << 20);
max_download_dir_size = max_download_dir_size * 1000000;
else
max_download_dir_size = DEFAULT_MAX_DOWNLOAD_DIR_SIZE;

Expand Down

0 comments on commit d5fa18f

Please sign in to comment.