mirror of
https://github.com/libp2p/go-libp2p-resource-manager.git
synced 2025-03-10 17:20:39 +08:00
remove unneded casts
This commit is contained in:
parent
b126e3b71e
commit
1ea897ee4d
4
scope.go
4
scope.go
@ -78,7 +78,7 @@ func NewTxnResourceScope(owner *ResourceScope) *ResourceScope {
|
||||
// Resources implementation
|
||||
func (rc *Resources) checkMemory(rsvp int64) error {
|
||||
// overflow check; this also has the side effect that we cannot reserve negative memory.
|
||||
newmem := rc.memory + int64(rsvp)
|
||||
newmem := rc.memory + rsvp
|
||||
if newmem < rc.memory {
|
||||
return fmt.Errorf("memory reservation overflow: %w", ErrResourceLimitExceeded)
|
||||
}
|
||||
@ -103,7 +103,7 @@ func (rc *Resources) reserveMemory(size int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
rc.memory += int64(size)
|
||||
rc.memory += size
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user