Removed the cloning of the final data in the attachment processor (#114)

* removed the cloning of the final data in the attachment processor

* fix linter
This commit is contained in:
marinthiercelin 2021-02-19 14:54:31 +01:00 committed by GitHub
parent 681ceb0546
commit cea3d0da4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View file

@ -6,6 +6,9 @@ linters-settings:
funlen:
lines: 100
statements: 80
cyclop:
# the minimal code complexity to report
max-complexity: 20
issues:
exclude-use-default: false
@ -33,3 +36,5 @@ linters:
- paralleltest # Detects missing usage of t.Parallel() method in your Go test
- forbidigo # Static analysis tool to forbid use of particular identifiers
- thelper # Enforce test helper formatting
- revive # Force CamelCase instead of all caps
- cyclop # Temp disabling because of a bug that ignores the setting TODO : enable it once the fix as been released

View file

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## Changed
- Removed an unecessary cloning in the attachment processor, to perform better in low memory settings
## [2.1.4] 2021-01-08
### Added
- Methods for generating an verifying encrypted detached signatures

View file

@ -90,7 +90,9 @@ func (keyRing *KeyRing) newAttachmentProcessor(
go func() {
defer attachmentProc.done.Done()
ciphertext, _ := ioutil.ReadAll(reader)
message := NewPGPMessage(ciphertext)
message := &PGPMessage{
Data: ciphertext,
}
split, splitError := message.SeparateKeyAndData(estimatedSize, garbageCollector)
if attachmentProc.err != nil {
attachmentProc.err = splitError

View file

@ -130,7 +130,7 @@ func (keyRing *KeyRing) GetKeyIDs() []uint64 {
// parts of these KeyRings.
func FilterExpiredKeys(contactKeys []*KeyRing) (filteredKeys []*KeyRing, err error) {
now := time.Now()
hasExpiredEntity := false
hasExpiredEntity := false //nolint:ifshort
filteredKeys = make([]*KeyRing, 0)
for _, contactKeyRing := range contactKeys {