Merge branch 'fix/download_stats' into 'master'

Fix: fix transfer stats receiving seconds instead of ms to work with

See merge request sheepitrenderfarm/client!232
This commit is contained in:
Sheepit Renderfarm
2023-09-09 10:40:19 +00:00
2 changed files with 4 additions and 4 deletions

View File

@@ -536,7 +536,7 @@ public class Server extends Thread {
gui_.displayTransferStats(dlStats, ulStats); gui_.displayTransferStats(dlStats, ulStats);
gui_.status(status_, 100, size); gui_.status(status_, 100, size);
this.log.debug(String.format("File downloaded at %s/s, written %d bytes", new TransferStats(size, duration.getSeconds() + 1).getAverageSessionSpeed(), written)); this.log.debug(String.format("File downloaded at %s/s, written %d bytes", new TransferStats(size, duration.toMillis() + 1).getAverageSessionSpeed(), written));
this.lastRequestTime = new Date().getTime(); this.lastRequestTime = new Date().getTime();
return Error.Type.OK; return Error.Type.OK;
@@ -613,7 +613,7 @@ public class Server extends Thread {
this.ulStats.calc(fileHandler.length(), ((duration.getSeconds() * 1000) + (duration.getNano() / 1000000))); this.ulStats.calc(fileHandler.length(), ((duration.getSeconds() * 1000) + (duration.getNano() / 1000000)));
gui.displayTransferStats(dlStats, ulStats); gui.displayTransferStats(dlStats, ulStats);
this.log.debug(String.format("File uploaded at %s/s, uploaded %d bytes", new TransferStats(fileHandler.length(), duration.getSeconds() + 1).getAverageSessionSpeed(), fileHandler.length())); this.log.debug(String.format("File uploaded at %s/s, uploaded %d bytes", new TransferStats(fileHandler.length(), duration.toMillis() + 1).getAverageSessionSpeed(), fileHandler.length()));
int r = response.code(); int r = response.code();
String contentType = response.body().contentType().toString(); String contentType = response.body().contentType().toString();

View File

@@ -4,8 +4,8 @@ import lombok.AllArgsConstructor;
/**************** /****************
* Holds the session traffic statistics. The constructor accepts two parameters: * Holds the session traffic statistics. The constructor accepts two parameters:
* @long bytes - bytes transferred in the session * long bytes - bytes transferred in the session
* @Job seconds - seconds spent transferring the data * long millis - milliseconds spent transferring the data
*/ */
@AllArgsConstructor @AllArgsConstructor
public class TransferStats { public class TransferStats {