Piwigo / Piwigo-Android

Piwigo Native Android App
GNU General Public License v3.0
140 stars 43 forks source link

Image upload order issue #124

Closed Valou447 closed 4 years ago

Valou447 commented 5 years ago

Describe the bug and how to reproduce For example, if we try to upload 6 photos by picking up all of them at the same time, the upload requests are sent sequentially within a second.

Expected behavior We should wait for the upload result of the previous photo before sending the next request, as the responses may (and it happens quite often) lose their order when received, and create some issues within the program.

I agree with @plegal's point that it is a problem in terms of optimization; and it could create bugs we could avoid. (maybe doing some benchmarks to test out what way is the best ?)

ramack commented 5 years ago

I agree, that we should handle uploads sequentially, I'll try to take a look.

ramack commented 5 years ago

But I think also #118 and #102 quite closely related so I propose to do all of them in a bunch, or did you already start working on one of them?

Valou447 commented 5 years ago

I’m working on #118 (but it should fix #102)

Actually issue/118-improve-upload branch would add and fix a lot of fixes (such as progress bar when uploading, album refresh, multiple files upload and so on..)

ramack commented 5 years ago

Ah you assigned this one here to both of us. So what was your intention with that? I had the impression you wanted me to work on these...

Valou447 commented 5 years ago

I just wanted to have your advices and maybe some suggestions on how we could achieve this.

But yet if you don’t have much time I can do it by my side 😉

ramack commented 5 years ago

Ok. I would propose a queue, where you put 'UploadActions', a small class holding the filename and the metadata for one photo instead of direct uploading as it is now. The backgroundService can then take the photos out and upload them one after another.

For the progressbar I propose to have a query in UploadAction which returns a value (the size in bytes) for the element. The bachgroundservice iterates over all stored actions (so it has to be an own queue implementarion) and calculateds the sum of all actions and relates it to 100%. Each transferred byte increases the progress. At the beginning you can just add the size after a full transfer of one element for simplicity.

In the long term we can extend this.with all kind of actions like create album, renamephoto, move photo etc...

Valou447 commented 4 years ago

Done in #127.