Skip to content

Commit

Permalink
Use FileChannel force to make sure the fusemount writes the tiff file…
Browse files Browse the repository at this point in the history
…s before the executor gets closed. #329
  • Loading branch information
EmileSonneveld committed Oct 14, 2024
1 parent f3cfeaf commit 49cbacb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import software.amazon.awssdk.services.s3.model.PutObjectRequest
import spire.math.Integral
import spire.syntax.cfor.cfor

import java.nio.channels.FileChannel
import java.nio.file.{Path, Paths}
import java.time.Duration
import java.time.format.DateTimeFormatter
Expand Down Expand Up @@ -838,6 +839,10 @@ package object geotiff {

} else {
geoTiff.write(path, optimizedOrder = true)
// Call fsync on the parent path to assure the fusemount is up-to data:
val channel = FileChannel.open(Path.of(path))
// Ensure that all changes to the file are written to disk
channel.force(true) // The equivalent of Python's os.fsync
path
}

Expand Down

0 comments on commit 49cbacb

Please sign in to comment.