Closed d2roth closed 5 years ago
That's a great performance improvement indeed!
On 10 March 2018 at 20:39, d2roth notifications@github.com wrote:
Hey @Wanchai https://github.com/wanchai, I use the BBJson.php version of your script and I have noticed that if I make 5 commits to the same file before I push it up the file will be uploaded 5 times, one for each commit. To me, this is really inefficient so I have been trying to come up with a solution.
I don't have a full solution yet but I am thinking to solve the problem would require changing ksort($this->data->branch[$ branch_name]['commits']); to use krsort. Then when the files are actually uploaded, in load_files() if the file has been previously uploaded skip it. So change foreach ($commit['files'] as $file) { to something like:
foreach ($commit['files'] as $file) { // Check if the file has been handled already if(isset($files_handled[$file['file']])){ continue; } else { $files_handled[$file['file']] = 1; } / ... /}
The $files_handled array would be initialized just after load_files() is opened.
Do you think this would help?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Wanchai/FTPbucket/issues/20, or mute the thread https://github.com/notifications/unsubscribe-auth/AAj7Tf2iX-iH-3-BFEaCy_1n7NhEHOcAks5tdCv_gaJpZM4SlaM4 .
Hey @Wanchai, I use the BBJson.php version of your script and I have noticed that if I make 5 commits to the same file before I push it up the file will be uploaded 5 times, one for each commit. To me, this is really inefficient so I have been trying to come up with a solution.
I don't have a full solution yet but I am thinking to solve the problem would require changing
ksort($this->data->branch[$branch_name]['commits']);
to use krsort. Then when the files are actually uploaded, inload_files()
if the file has been previously uploaded skip it. So changeforeach ($commit['files'] as $file) {
to something like:The
$files_handled
array would be initialized just afterload_files()
is opened.Do you think this would help?