summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2023-07-14 15:17:35 -0400
committerWill Hawkins <[email protected]>2023-07-14 15:17:35 -0400
commit123e75ac641721de9c19a652c9b1450b60bc7ef9 (patch)
treeea84aacd98f7cde970e6b19d613f9e817b70e4e2
parent0b2e44c50fcb4dd89120ef0608ba09daca12c0f2 (diff)
[Bugfix] Accessing channel without protection
I was accessing a lock-protected channel without holding the lock. That definitely seems to defeat the purpose of having the lock in the first place. Signed-off-by: Will Hawkins <[email protected]>
-rw-r--r--rpm/rpm.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/rpm/rpm.go b/rpm/rpm.go
index 95e6192..d1c07a5 100644
--- a/rpm/rpm.go
+++ b/rpm/rpm.go
@@ -150,10 +150,14 @@ func ResponsivenessProber[BucketType utilities.Number](
currentBucketId := bucketGenerator.Generate()
- dataPoints <- series.SeriesMessage[ResponsivenessProbeResult, BucketType]{
- Type: series.SeriesMessageReserve, Bucket: currentBucketId,
- Measure: utilities.None[ResponsivenessProbeResult](),
+ dataPointsLock.Lock()
+ if dataPoints != nil {
+ dataPoints <- series.SeriesMessage[ResponsivenessProbeResult, BucketType]{
+ Type: series.SeriesMessageReserve, Bucket: currentBucketId,
+ Measure: utilities.None[ResponsivenessProbeResult](),
+ }
}
+ dataPointsLock.Unlock()
// The presence of a custom TLSClientConfig in a *generic* `transport`
// means that go will default to HTTP/1.1 and cowardly avoid HTTP/2: