Compare commits

...
3 Commits
Author SHA1 Message Date
Nick Craig-Wood 1bdab29eab Version v1.49.3 2019-09-15 16:42:10 +01:00
Nick Craig-Wood f77027e6b7 fs/accounting: Fix "file already closed" on transfer retries
This was caused by the recent reworking of the accounting interface.
The Transfer object was recycling the Accounting object without
resetting the stream.

See: https://forum.rclone.org/t/error-file-already-closed/11469/
See: https://forum.rclone.org/t/rclone-b2-sync-post-error-method-not-supported/11718/
2019-09-13 18:37:01 +01:00
Aleksandar Jankovic f73d0eb920 accounting: fix total duration calculation
Fixes: #3498
2019-09-12 12:33:57 +01:00
81 changed files with 213 additions and 121 deletions

No files matched your search

Generated
+13 -2
View File
@@ -17,7 +17,7 @@
<header>
<h1 class="title">rclone(1) User Manual</h1>
<p class="author">Nick Craig-Wood</p>
<p class="date">Sep 08, 2019</p>
<p class="date">Sep 15, 2019</p>
</header>
<h1 id="rclone---rsync-for-cloud-storage">Rclone - rsync for cloud storage</h1>
<p>Rclone is a command line program to sync files and directories to and from:</p>
@@ -4610,7 +4610,7 @@ Showing nodes accounting for 1537.03kB, 100% of 1537.03kB total
--use-json-log Use json log format.
--use-mmap Use mmap allocator (see docs).
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default &quot;rclone/v1.49.2&quot;)
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default &quot;rclone/v1.49.3&quot;)
-v, --verbose count Print lots more stuff (repeat for more)</code></pre>
<h2 id="backend-flags">Backend Flags</h2>
<p>These flags are available for every command. They control the backends and may be set in the config file.</p>
@@ -12308,6 +12308,17 @@ $ tree /tmp/b
</ul>
<!--- autogenerated options stop -->
<h1 id="changelog">Changelog</h1>
<h2 id="v1.49.3---2019-09-15">v1.49.3 - 2019-09-15</h2>
<ul>
<li>Bug Fixes
<ul>
<li>accounting
<ul>
<li>Fix total duration calculation (Aleksandar Jankovic)</li>
<li>Fix “file already closed” on transfer retries (Nick Craig-Wood)</li>
</ul></li>
</ul></li>
</ul>
<h2 id="v1.49.2---2019-09-08">v1.49.2 - 2019-09-08</h2>
<ul>
<li>New Features
Generated
+9 -2
View File
@@ -1,6 +1,6 @@
% rclone(1) User Manual
% Nick Craig-Wood
% Sep 08, 2019
% Sep 15, 2019
# Rclone - rsync for cloud storage
@@ -8279,7 +8279,7 @@ These flags are available for every command.
--use-json-log Use json log format.
--use-mmap Use mmap allocator (see docs).
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.49.2")
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.49.3")
-v, --verbose count Print lots more stuff (repeat for more)
```
@@ -18500,6 +18500,13 @@ to override the default choice.
# Changelog
## v1.49.3 - 2019-09-15
* Bug Fixes
* accounting
* Fix total duration calculation (Aleksandar Jankovic)
* Fix "file already closed" on transfer retries (Nick Craig-Wood)
## v1.49.2 - 2019-09-08
* New Features
Generated
+11 -2
View File
@@ -1,6 +1,6 @@
rclone(1) User Manual
Nick Craig-Wood
Sep 08, 2019
Sep 15, 2019
@@ -7856,7 +7856,7 @@ These flags are available for every command.
--use-json-log Use json log format.
--use-mmap Use mmap allocator (see docs).
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.49.2")
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.49.3")
-v, --verbose count Print lots more stuff (repeat for more)
@@ -17955,6 +17955,15 @@ override the default choice.
CHANGELOG
v1.49.3 - 2019-09-15
- Bug Fixes
- accounting
- Fix total duration calculation (Aleksandar Jankovic)
- Fix “file already closed” on transfer retries (Nick
Craig-Wood)
v1.49.2 - 2019-09-08
- New Features
+8 -1
View File
@@ -1,11 +1,18 @@
---
title: "Documentation"
description: "Rclone Changelog"
date: "2019-09-08"
date: "2019-09-15"
---
# Changelog
## v1.49.3 - 2019-09-15
* Bug Fixes
* accounting
* Fix total duration calculation (Aleksandar Jankovic)
* Fix "file already closed" on transfer retries (Nick Craig-Wood)
## v1.49.2 - 2019-09-08
* New Features
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone"
slug: rclone
url: /commands/rclone/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone about"
slug: rclone_about
url: /commands/rclone_about/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone authorize"
slug: rclone_authorize
url: /commands/rclone_authorize/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone cachestats"
slug: rclone_cachestats
url: /commands/rclone_cachestats/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone cat"
slug: rclone_cat
url: /commands/rclone_cat/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone check"
slug: rclone_check
url: /commands/rclone_check/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone cleanup"
slug: rclone_cleanup
url: /commands/rclone_cleanup/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config"
slug: rclone_config
url: /commands/rclone_config/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config create"
slug: rclone_config_create
url: /commands/rclone_config_create/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config delete"
slug: rclone_config_delete
url: /commands/rclone_config_delete/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config disconnect"
slug: rclone_config_disconnect
url: /commands/rclone_config_disconnect/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config dump"
slug: rclone_config_dump
url: /commands/rclone_config_dump/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config edit"
slug: rclone_config_edit
url: /commands/rclone_config_edit/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config file"
slug: rclone_config_file
url: /commands/rclone_config_file/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config password"
slug: rclone_config_password
url: /commands/rclone_config_password/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config providers"
slug: rclone_config_providers
url: /commands/rclone_config_providers/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config reconnect"
slug: rclone_config_reconnect
url: /commands/rclone_config_reconnect/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config show"
slug: rclone_config_show
url: /commands/rclone_config_show/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config update"
slug: rclone_config_update
url: /commands/rclone_config_update/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone config userinfo"
slug: rclone_config_userinfo
url: /commands/rclone_config_userinfo/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone copy"
slug: rclone_copy
url: /commands/rclone_copy/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone copyto"
slug: rclone_copyto
url: /commands/rclone_copyto/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone copyurl"
slug: rclone_copyurl
url: /commands/rclone_copyurl/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone cryptcheck"
slug: rclone_cryptcheck
url: /commands/rclone_cryptcheck/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone cryptdecode"
slug: rclone_cryptdecode
url: /commands/rclone_cryptdecode/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone dbhashsum"
slug: rclone_dbhashsum
url: /commands/rclone_dbhashsum/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone dedupe"
slug: rclone_dedupe
url: /commands/rclone_dedupe/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone delete"
slug: rclone_delete
url: /commands/rclone_delete/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone deletefile"
slug: rclone_deletefile
url: /commands/rclone_deletefile/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone genautocomplete"
slug: rclone_genautocomplete
url: /commands/rclone_genautocomplete/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone genautocomplete bash"
slug: rclone_genautocomplete_bash
url: /commands/rclone_genautocomplete_bash/
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone genautocomplete zsh"
slug: rclone_genautocomplete_zsh
url: /commands/rclone_genautocomplete_zsh/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone gendocs"
slug: rclone_gendocs
url: /commands/rclone_gendocs/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone hashsum"
slug: rclone_hashsum
url: /commands/rclone_hashsum/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone link"
slug: rclone_link
url: /commands/rclone_link/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone listremotes"
slug: rclone_listremotes
url: /commands/rclone_listremotes/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone ls"
slug: rclone_ls
url: /commands/rclone_ls/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone lsd"
slug: rclone_lsd
url: /commands/rclone_lsd/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone lsf"
slug: rclone_lsf
url: /commands/rclone_lsf/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone lsjson"
slug: rclone_lsjson
url: /commands/rclone_lsjson/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone lsl"
slug: rclone_lsl
url: /commands/rclone_lsl/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone md5sum"
slug: rclone_md5sum
url: /commands/rclone_md5sum/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone mkdir"
slug: rclone_mkdir
url: /commands/rclone_mkdir/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone mount"
slug: rclone_mount
url: /commands/rclone_mount/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone move"
slug: rclone_move
url: /commands/rclone_move/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone moveto"
slug: rclone_moveto
url: /commands/rclone_moveto/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone ncdu"
slug: rclone_ncdu
url: /commands/rclone_ncdu/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone obscure"
slug: rclone_obscure
url: /commands/rclone_obscure/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone purge"
slug: rclone_purge
url: /commands/rclone_purge/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone rc"
slug: rclone_rc
url: /commands/rclone_rc/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone rcat"
slug: rclone_rcat
url: /commands/rclone_rcat/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone rcd"
slug: rclone_rcd
url: /commands/rclone_rcd/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone rmdir"
slug: rclone_rmdir
url: /commands/rclone_rmdir/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone rmdirs"
slug: rclone_rmdirs
url: /commands/rclone_rmdirs/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve"
slug: rclone_serve
url: /commands/rclone_serve/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve dlna"
slug: rclone_serve_dlna
url: /commands/rclone_serve_dlna/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve ftp"
slug: rclone_serve_ftp
url: /commands/rclone_serve_ftp/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve http"
slug: rclone_serve_http
url: /commands/rclone_serve_http/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve restic"
slug: rclone_serve_restic
url: /commands/rclone_serve_restic/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve sftp"
slug: rclone_serve_sftp
url: /commands/rclone_serve_sftp/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone serve webdav"
slug: rclone_serve_webdav
url: /commands/rclone_serve_webdav/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone settier"
slug: rclone_settier
url: /commands/rclone_settier/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone sha1sum"
slug: rclone_sha1sum
url: /commands/rclone_sha1sum/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone size"
slug: rclone_size
url: /commands/rclone_size/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone sync"
slug: rclone_sync
url: /commands/rclone_sync/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone touch"
slug: rclone_touch
url: /commands/rclone_touch/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone tree"
slug: rclone_tree
url: /commands/rclone_tree/
+1 -1
View File
@@ -1,5 +1,5 @@
---
date: 2019-09-08T16:48:33+01:00
date: 2019-09-15T16:41:55+01:00
title: "rclone version"
slug: rclone_version
url: /commands/rclone_version/
+2 -2
View File
@@ -1,7 +1,7 @@
---
title: "Global Flags"
description: "Rclone Global Flags"
date: "2019-09-08T16:48:33+01:00"
date: "2019-09-15T16:41:55+01:00"
---
# Global Flags
@@ -127,7 +127,7 @@ These flags are available for every command.
--use-json-log Use json log format.
--use-mmap Use mmap allocator (see docs).
--use-server-modtime Use server modified time instead of object metadata
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.49.2")
--user-agent string Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.49.3")
-v, --verbose count Print lots more stuff (repeat for more)
```
+1 -1
View File
@@ -1 +1 @@
v1.49.2
v1.49.3
+6 -2
View File
@@ -118,11 +118,15 @@ func (acc *Account) StopBuffering() {
// async buffer (if any) and re-adding it
func (acc *Account) UpdateReader(in io.ReadCloser) {
acc.mu.Lock()
acc.StopBuffering()
if acc.withBuf {
acc.StopBuffering()
}
acc.in = in
acc.close = in
acc.origIn = in
acc.WithBuffer()
if acc.withBuf {
acc.WithBuffer()
}
acc.mu.Unlock()
}
+1 -1
View File
@@ -138,7 +138,7 @@ func (s *StatsInfo) totalDuration() time.Duration {
var total time.Duration
var i, j = 0, 1
for i < len(timeRanges) {
if j < len(timeRanges)-1 {
if j < len(timeRanges) {
if timeRanges[j].start.Before(timeRanges[i].end) {
if timeRanges[i].end.Before(timeRanges[j].end) {
timeRanges[i].end = timeRanges[j].end
+75 -37
View File
@@ -130,52 +130,90 @@ func TestStatsError(t *testing.T) {
}
func TestStatsTotalDuration(t *testing.T) {
time1 := time.Now().Add(-40 * time.Second)
startTime := time.Now()
time1 := startTime.Add(-40 * time.Second)
time2 := time1.Add(10 * time.Second)
time3 := time2.Add(10 * time.Second)
time4 := time3.Add(10 * time.Second)
s := NewStats()
s.AddTransfer(&Transfer{
startedAt: time2,
completedAt: time3,
})
s.AddTransfer(&Transfer{
startedAt: time2,
completedAt: time2.Add(time.Second),
})
s.AddTransfer(&Transfer{
startedAt: time1,
completedAt: time3,
})
s.AddTransfer(&Transfer{
startedAt: time3,
completedAt: time4,
})
s.AddTransfer(&Transfer{
startedAt: time.Now(),
t.Run("Single completed transfer", func(t *testing.T) {
s := NewStats()
s.AddTransfer(&Transfer{
startedAt: time1,
completedAt: time2,
})
s.mu.Lock()
total := s.totalDuration()
s.mu.Unlock()
assert.Equal(t, 10*time.Second, total)
})
time.Sleep(time.Millisecond)
t.Run("Single uncompleted transfer", func(t *testing.T) {
s := NewStats()
s.AddTransfer(&Transfer{
startedAt: time1,
})
s.mu.Lock()
total := s.totalDuration()
s.mu.Unlock()
s.mu.Lock()
total := s.totalDuration()
s.mu.Unlock()
assert.True(t, 30*time.Second < total && total < 31*time.Second, total)
}
assert.Equal(t, time.Since(time1)/time.Second, total/time.Second)
})
t.Run("Overlapping without ending", func(t *testing.T) {
s := NewStats()
s.AddTransfer(&Transfer{
startedAt: time2,
completedAt: time3,
})
s.AddTransfer(&Transfer{
startedAt: time2,
completedAt: time2.Add(time.Second),
})
s.AddTransfer(&Transfer{
startedAt: time1,
completedAt: time3,
})
s.AddTransfer(&Transfer{
startedAt: time3,
completedAt: time4,
})
s.AddTransfer(&Transfer{
startedAt: time.Now(),
})
time.Sleep(time.Millisecond)
func TestStatsTotalDuration2(t *testing.T) {
time1 := time.Now().Add(-40 * time.Second)
time2 := time1.Add(10 * time.Second)
s := NewStats()
s.AddTransfer(&Transfer{
startedAt: time1,
completedAt: time2,
s.mu.Lock()
total := s.totalDuration()
s.mu.Unlock()
assert.Equal(t, time.Duration(30), total/time.Second)
})
s.mu.Lock()
total := s.totalDuration()
s.mu.Unlock()
t.Run("Mixed completed and uncompleted transfers", func(t *testing.T) {
s := NewStats()
s.AddTransfer(&Transfer{
startedAt: time1,
completedAt: time2,
})
s.AddTransfer(&Transfer{
startedAt: time2,
})
s.AddTransfer(&Transfer{
startedAt: time3,
})
s.AddTransfer(&Transfer{
startedAt: time3,
})
s.mu.Lock()
total := s.totalDuration()
s.mu.Unlock()
assert.Equal(t, 10*time.Second, total)
assert.Equal(t, startTime.Sub(time1)/time.Second, total/time.Second)
})
}
+2
View File
@@ -117,6 +117,8 @@ func (tr *Transfer) Account(in io.ReadCloser) *Account {
tr.mu.Lock()
if tr.acc == nil {
tr.acc = newAccountSizeName(tr.stats, in, tr.size, tr.remote)
} else {
tr.acc.UpdateReader(in)
}
tr.mu.Unlock()
return tr.acc
+1
View File
@@ -341,6 +341,7 @@ func Copy(ctx context.Context, f fs.Fs, dst fs.Object, remote string, src fs.Obj
} else {
actionTaken = "Copied (Rcat, new)"
}
// NB Rcat closes in0
dst, err = Rcat(ctx, f, remote, in0, src.ModTime(ctx))
newDst = dst
} else {
+1 -1
View File
@@ -1,4 +1,4 @@
package fs
// Version of rclone
var Version = "v1.49.2"
var Version = "v1.49.3"
Generated
+15 -2
View File
@@ -1,7 +1,7 @@
.\"t
.\" Automatically generated by Pandoc 2.2.1
.\"
.TH "rclone" "1" "Sep 08, 2019" "User Manual" ""
.TH "rclone" "1" "Sep 15, 2019" "User Manual" ""
.hy
.SH Rclone \- rsync for cloud storage
.PP
@@ -10505,7 +10505,7 @@ These flags are available for every command.
\ \ \ \ \ \ \-\-use\-json\-log\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Use\ json\ log\ format.
\ \ \ \ \ \ \-\-use\-mmap\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Use\ mmap\ allocator\ (see\ docs).
\ \ \ \ \ \ \-\-use\-server\-modtime\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Use\ server\ modified\ time\ instead\ of\ object\ metadata
\ \ \ \ \ \ \-\-user\-agent\ string\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Set\ the\ user\-agent\ to\ a\ specified\ string.\ The\ default\ is\ rclone/\ version\ (default\ "rclone/v1.49.2")
\ \ \ \ \ \ \-\-user\-agent\ string\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Set\ the\ user\-agent\ to\ a\ specified\ string.\ The\ default\ is\ rclone/\ version\ (default\ "rclone/v1.49.3")
\ \ \-v,\ \-\-verbose\ count\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Print\ lots\ more\ stuff\ (repeat\ for\ more)
\f[]
.fi
@@ -23691,6 +23691,19 @@ Type: bool
.IP \[bu] 2
Default: false
.SH Changelog
.SS v1.49.3 \- 2019\-09\-15
.IP \[bu] 2
Bug Fixes
.RS 2
.IP \[bu] 2
accounting
.RS 2
.IP \[bu] 2
Fix total duration calculation (Aleksandar Jankovic)
.IP \[bu] 2
Fix \[lq]file already closed\[rq] on transfer retries (Nick Craig\-Wood)
.RE
.RE
.SS v1.49.2 \- 2019\-09\-08
.IP \[bu] 2
New Features