fix(inputs.cloud_pubsub): Properly lock for decompression (#13525)
This commit is contained in:
parent
435e42cfd4
commit
590e4e5bc7
|
|
@ -217,12 +217,11 @@ func (ps *PubSub) decompressData(data []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ps.decoderMutex.Lock()
|
ps.decoderMutex.Lock()
|
||||||
|
defer ps.decoderMutex.Unlock()
|
||||||
data, err := ps.decoder.Decode(data)
|
data, err := ps.decoder.Decode(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ps.decoderMutex.Unlock()
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ps.decoderMutex.Unlock()
|
|
||||||
|
|
||||||
decompressedData := make([]byte, len(data))
|
decompressedData := make([]byte, len(data))
|
||||||
copy(decompressedData, data)
|
copy(decompressedData, data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue