mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-19 05:36:58 +00:00
Update weed/topology/node.go
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent
9a4825c3f6
commit
a24a51e3fa
@@ -95,13 +95,14 @@ func (cr *CapacityReservations) tryReserveAtomic(diskType types.DiskType, count
|
||||
|
||||
if availableSpace >= count {
|
||||
// Create and add reservation atomically
|
||||
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
|
||||
return reservationId, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user