@@ -248,13 +248,9 @@ func (w *WriteCounter) SaveProcess() {
248
248
}
249
249
by , _ := json .Marshal (process )
250
250
if percentValue < 100 {
251
- if err := global .CACHE .Set (w .Key , string (by )); err != nil {
252
- global .LOG .Errorf ("save cache error, err %s" , err .Error ())
253
- }
251
+ global .CACHE .Set (w .Key , string (by ))
254
252
} else {
255
- if err := global .CACHE .SetWithTTL (w .Key , string (by ), time .Second * time .Duration (10 )); err != nil {
256
- global .LOG .Errorf ("save cache error, err %s" , err .Error ())
257
- }
253
+ global .CACHE .SetWithTTL (w .Key , string (by ), time .Second * time .Duration (10 ))
258
254
}
259
255
}
260
256
@@ -293,20 +289,14 @@ func (f FileOp) DownloadFileWithProcess(url, dst, key string, ignoreCertificate
293
289
out .Close ()
294
290
resp .Body .Close ()
295
291
296
- value , err := global .CACHE .Get (counter .Key )
297
- if err != nil {
298
- global .LOG .Errorf ("get cache error,err %s" , err .Error ())
299
- return
300
- }
292
+ value := global .CACHE .Get (counter .Key )
301
293
process := & Process {}
302
- _ = json .Unmarshal (value , process )
294
+ _ = json .Unmarshal ([] byte ( value ) , process )
303
295
process .Percent = 100
304
296
process .Name = counter .Name
305
297
process .Total = process .Written
306
298
by , _ := json .Marshal (process )
307
- if err := global .CACHE .SetWithTTL (counter .Key , string (by ), time .Second * time .Duration (10 )); err != nil {
308
- global .LOG .Errorf ("save cache error, err %s" , err .Error ())
309
- }
299
+ global .CACHE .Set (counter .Key , string (by ))
310
300
}()
311
301
return nil
312
302
}
0 commit comments