@@ -78,7 +78,8 @@ type SlotReservationInfo interface {
78
78
WorkerBuildId () string
79
79
// WorkerBuildId returns the build ID of the worker that is reserving the slot.
80
80
WorkerIdentity () string
81
- // NumIssuedSlots returns the number of slots that have already been issued by the supplier.
81
+ // NumIssuedSlots returns the current number of slots that have already been issued by the
82
+ // supplier. This value may change over the course of the reservation.
82
83
NumIssuedSlots () int
83
84
// Logger returns an appropriately tagged logger.
84
85
Logger () log.Logger
@@ -328,7 +329,7 @@ type slotReserveInfoImpl struct {
328
329
taskQueue string
329
330
workerBuildId string
330
331
workerIdentity string
331
- issuedSlots int
332
+ issuedSlots * atomic. Int32
332
333
logger log.Logger
333
334
metrics metrics.Handler
334
335
}
@@ -346,7 +347,7 @@ func (s slotReserveInfoImpl) WorkerIdentity() string {
346
347
}
347
348
348
349
func (s slotReserveInfoImpl ) NumIssuedSlots () int {
349
- return s .issuedSlots
350
+ return int ( s .issuedSlots . Load ())
350
351
}
351
352
352
353
func (s slotReserveInfoImpl ) Logger () log.Logger {
@@ -442,7 +443,7 @@ func (t *trackingSlotSupplier) ReserveSlot(
442
443
taskQueue : data .taskQueue ,
443
444
workerBuildId : t .workerBuildId ,
444
445
workerIdentity : t .workerIdentity ,
445
- issuedSlots : int ( t .issuedSlotsAtomic . Load ()) ,
446
+ issuedSlots : & t .issuedSlotsAtomic ,
446
447
logger : t .logger ,
447
448
metrics : t .metrics ,
448
449
})
@@ -465,7 +466,7 @@ func (t *trackingSlotSupplier) TryReserveSlot(data *slotReservationData) *SlotPe
465
466
taskQueue : data .taskQueue ,
466
467
workerBuildId : t .workerBuildId ,
467
468
workerIdentity : t .workerIdentity ,
468
- issuedSlots : int ( t .issuedSlotsAtomic . Load ()) ,
469
+ issuedSlots : & t .issuedSlotsAtomic ,
469
470
logger : t .logger ,
470
471
metrics : t .metrics ,
471
472
})
0 commit comments