@@ -20,6 +20,7 @@ import (
20
20
"os"
21
21
"path"
22
22
"runtime"
23
+ "strconv"
23
24
"time"
24
25
25
26
"github.com/urfave/cli/v2"
@@ -120,9 +121,10 @@ func clientFlags() []cli.Flag {
120
121
Name : "writeback" ,
121
122
Usage : "upload objects in background" ,
122
123
},
123
- & cli.DurationFlag {
124
+ & cli.StringFlag {
124
125
Name : "upload-delay" ,
125
- Usage : "delayed duration for uploading objects (\" s\" , \" m\" , \" h\" )" ,
126
+ Value : "0" ,
127
+ Usage : "delayed duration (in seconds) for uploading objects" ,
126
128
},
127
129
& cli.StringFlag {
128
130
Name : "cache-dir" ,
@@ -143,15 +145,15 @@ func clientFlags() []cli.Flag {
143
145
Name : "cache-partial-only" ,
144
146
Usage : "cache only random/small read" ,
145
147
},
146
- & cli.DurationFlag {
148
+ & cli.StringFlag {
147
149
Name : "backup-meta" ,
148
- Value : time . Hour ,
149
- Usage : "interval to automatically backup metadata in the object storage (0 means disable backup)" ,
150
+ Value : "3600" ,
151
+ Usage : "interval (in seconds) to automatically backup metadata in the object storage (0 means disable backup)" ,
150
152
},
151
- & cli.DurationFlag {
153
+ & cli.StringFlag {
152
154
Name : "heartbeat" ,
153
- Value : 12 * time . Second ,
154
- Usage : "interval to send heartbeat; it's recommended that all clients use the same heartbeat value" ,
155
+ Value : "12" ,
156
+ Usage : "interval (in seconds) to send heartbeat; it's recommended that all clients use the same heartbeat value" ,
155
157
},
156
158
& cli.BoolFlag {
157
159
Name : "read-only" ,
@@ -219,3 +221,13 @@ func expandFlags(compoundFlags [][]cli.Flag) []cli.Flag {
219
221
}
220
222
return flags
221
223
}
224
+
225
+ func duration (s string ) time.Duration {
226
+ if v , err := strconv .ParseInt (s , 10 , 64 ); err == nil {
227
+ return time .Second * time .Duration (v )
228
+ }
229
+ if v , err := time .ParseDuration (s ); err == nil {
230
+ return v
231
+ }
232
+ return 0
233
+ }
0 commit comments