Update curl.cpp: reduce memory cache use (#2157)

flush the file and clean the page cache when filepart download done
This commit is contained in:
Tan Guofu 2023-05-27 18:15:47 +08:00 committed by GitHub
parent e7a364d610
commit 5b487f651a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -703,7 +703,12 @@ size_t S3fsCurl::DownloadWriteCallback(void* ptr, size_t size, size_t nmemb, voi
}
pCurl->partdata.startpos += totalwrite;
pCurl->partdata.size -= totalwrite;
// flush the file and clean the page cache
if (pCurl->partdata.size == 0){
fdatasync(pCurl->partdata.fd);
}
return totalwrite;
}