Skip to content

Commit

Permalink
Fix enrichment upload mechanism (closes #194)
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhanunlu committed Jun 5, 2019
1 parent 27a1b9f commit 7255b6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions provisioning/resources/control-plane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ func uploadEnrichments(resp http.ResponseWriter, req *http.Request) {
}
defer f.Close()

// Uploaded enrichment can be shorter than the existing one
// Truncating to 0 bytes and seeking I/O offset to the beginning
// Prevents the possibility of corrupted json
f.Truncate(0)
f.Seek(0, 0)
// Now we can write to file in peace
io.WriteString(f, fileContent)

err = restartService("streamEnrich")
Expand Down

0 comments on commit 7255b6b

Please sign in to comment.