diff options
| author | Will Hawkins <[email protected]> | 2023-07-14 15:17:35 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2023-07-14 15:17:35 -0400 |
| commit | 123e75ac641721de9c19a652c9b1450b60bc7ef9 (patch) | |
| tree | ea84aacd98f7cde970e6b19d613f9e817b70e4e2 | |
| parent | 0b2e44c50fcb4dd89120ef0608ba09daca12c0f2 (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.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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: |
