Hello everyone! I have some problem with correct calculating synchronization progress. I use GET /rest/db/status for getting infomation of sync folder and try to calculate by this formela:
result = Math.Floor(100 * (1 - (neededBytes / totalBytes))));
So I getting valid percentage, but I would like to other way of calculate. F.e there are files in the sync folder and they are synchronized. Next I add the files to the folder and I would like to get percentage from 0 - 100% like a copy progress not from current state% - 100%.
Hey, I can do maths as long as were talking applied math (I have not much clue about topology and similar nicenesses). That doesn’t sound like a math question though
There’s nothing built in. What you could do is subscribe to the event apib for folder status, then when it enters sync preparing our syncing status query db/status to get the initial haveBytes and then take that into account for “sync percentage”.
I don’t understand that. What I meant i pseudo-code:
for state in folderStateEventQueue:
if state == syncPreparing || state == syncing {
haveInitial = queryStatusEndpoint().haveBytes
break
status = queryStatusEndpoint
result = 100 * ((status.haveBytes - haveInitial) / (status.globalBytes - haveInitial))