fix(inputs.cloud_pubsub): Properly lock for decompression (#13525)

This commit is contained in:
Sven Rebhan 2023-06-30 18:27:25 +02:00 committed by GitHub
parent 435e42cfd4
commit 590e4e5bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -217,12 +217,11 @@ func (ps *PubSub) decompressData(data []byte) ([]byte, error) {
}
ps.decoderMutex.Lock()
defer ps.decoderMutex.Unlock()
data, err := ps.decoder.Decode(data)
if err != nil {
ps.decoderMutex.Unlock()
return nil, err
}
ps.decoderMutex.Unlock()
decompressedData := make([]byte, len(data))
copy(decompressedData, data)