From 3f08e271af08fff7c6e7a6b8d2d28ab4f08de85a Mon Sep 17 00:00:00 2001 From: abraunegg Date: Mon, 11 Mar 2019 17:56:26 +1100 Subject: [PATCH] Update util.d - reduce local FS read overheads (#407) * Try and read 1 byte of the file rather than 10MB for each 'new' file to be uploaded to validate local file permissions --- src/util.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util.d b/src/util.d index 8e4dc545..2f87643c 100644 --- a/src/util.d +++ b/src/util.d @@ -136,8 +136,9 @@ bool testNetwork() bool readLocalFile(string path) { try { - // attempt to read the first 10MB of the file - read(path,10000000); + // attempt to read up to the first 1 byte of the file + // validates we can 'read' the file based on file permissions + read(path,1); } catch (std.file.FileException e) { // unable to read the new local file log.log("Skipping uploading this file as it cannot be read (file permissions or file corruption): ", path);