mirror of https://github.com/cbeuw/Cloak
Fix credit not updating on termination
This commit is contained in:
parent
6ae3c27320
commit
acc0a1a2dd
|
|
@ -127,7 +127,6 @@ func (manager *localManager) UploadStatus(uploads []StatusUpdate) ([]StatusRespo
|
||||||
"User no longer exists",
|
"User no longer exists",
|
||||||
}
|
}
|
||||||
responses = append(responses, resp)
|
responses = append(responses, resp)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldUp := int64(Uint64(bucket.Get([]byte("UpCredit"))))
|
oldUp := int64(Uint64(bucket.Get([]byte("UpCredit"))))
|
||||||
|
|
@ -139,12 +138,10 @@ func (manager *localManager) UploadStatus(uploads []StatusUpdate) ([]StatusRespo
|
||||||
"No upload credit left",
|
"No upload credit left",
|
||||||
}
|
}
|
||||||
responses = append(responses, resp)
|
responses = append(responses, resp)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
err := bucket.Put([]byte("UpCredit"), i64ToB(newUp))
|
err := bucket.Put([]byte("UpCredit"), i64ToB(newUp))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldDown := int64(Uint64(bucket.Get([]byte("DownCredit"))))
|
oldDown := int64(Uint64(bucket.Get([]byte("DownCredit"))))
|
||||||
|
|
@ -156,12 +153,10 @@ func (manager *localManager) UploadStatus(uploads []StatusUpdate) ([]StatusRespo
|
||||||
"No download credit left",
|
"No download credit left",
|
||||||
}
|
}
|
||||||
responses = append(responses, resp)
|
responses = append(responses, resp)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
err = bucket.Put([]byte("DownCredit"), i64ToB(newDown))
|
err = bucket.Put([]byte("DownCredit"), i64ToB(newDown))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expiry := int64(Uint64(bucket.Get([]byte("ExpiryTime"))))
|
expiry := int64(Uint64(bucket.Get([]byte("ExpiryTime"))))
|
||||||
|
|
@ -172,7 +167,6 @@ func (manager *localManager) UploadStatus(uploads []StatusUpdate) ([]StatusRespo
|
||||||
"User has expired",
|
"User has expired",
|
||||||
}
|
}
|
||||||
responses = append(responses, resp)
|
responses = append(responses, resp)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue