Browse Source
Update weed/topology/node.go
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
pull/7159/head
Chris Lu
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
8 additions and
7 deletions
-
weed/topology/node.go
|
@ -44,13 +44,14 @@ func (cr *CapacityReservations) addReservation(diskType types.DiskType, count in |
|
|
cr.Lock() |
|
|
cr.Lock() |
|
|
defer cr.Unlock() |
|
|
defer cr.Unlock() |
|
|
|
|
|
|
|
|
reservationId := fmt.Sprintf("%s-%d-%d-%d", diskType, count, time.Now().UnixNano(), rand.Int64()) |
|
|
|
|
|
cr.reservations[reservationId] = &CapacityReservation{ |
|
|
|
|
|
reservationId: reservationId, |
|
|
|
|
|
diskType: diskType, |
|
|
|
|
|
count: count, |
|
|
|
|
|
createdAt: time.Now(), |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
now := time.Now() |
|
|
|
|
|
reservationId := fmt.Sprintf("%s-%d-%d-%d", diskType, count, now.UnixNano(), rand.Int64()) |
|
|
|
|
|
cr.reservations[reservationId] = &CapacityReservation{ |
|
|
|
|
|
reservationId: reservationId, |
|
|
|
|
|
diskType: diskType, |
|
|
|
|
|
count: count, |
|
|
|
|
|
createdAt: now, |
|
|
|
|
|
} |
|
|
cr.reservedCounts[diskType] += count |
|
|
cr.reservedCounts[diskType] += count |
|
|
return reservationId |
|
|
return reservationId |
|
|
} |
|
|
} |
|
|