Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -165,11 +165,11 @@ func main() { var inputMetadata *input.MetadataStruct id := inputClient.ID(file) - cacheMapMutex.Lock() if _, ok := cacheMap[id]; !ok { + cacheMapMutex.Lock() cacheMap[id] = make(map[uint32]struct{}) + cacheMapMutex.Unlock() } - cacheMapMutex.Unlock() convertersToLaunch := []int{} for j, conv := range converters { @@ -239,14 +239,10 @@ func main() { return } - fileContent, err := io.ReadAll(reader) - if err != nil { + fileContent := make([]byte, inputMetadata.Size) + if _, err = reader.Read(fileContent); err != nil { fileLogger.Warn("fail to read content of input file", slog.String("error", err.Error())) return - } else if int64(len(fileContent)) != inputMetadata.Size { - fileLogger.Warn("the downloaded file seems to be missing some of its content", - slog.Int("actual_size_bytes", len(fileContent)), - slog.Int64("expected_size_bytes", inputMetadata.Size)) } reader.Close() |