From 876cfac192ceacd07f4aedc3988b9f0ee982a49e Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Thu, 24 Nov 2022 03:18:35 -0800 Subject: [PATCH] exif: increase timeout to 30s --- lib/Exif.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Exif.php b/lib/Exif.php index f7bc2755..32fb011e 100644 --- a/lib/Exif.php +++ b/lib/Exif.php @@ -11,6 +11,7 @@ use OCP\IConfig; class Exif { private const EXIFTOOL_VER = '12.49'; + private const EXIFTOOL_TIMEOUT = 30000; /** Opened instance of exiftool when running in command mode */ private static $staticProc; @@ -248,7 +249,7 @@ class Exif fwrite($pipes[0], $raw); fclose($pipes[0]); - $stdout = self::readOrTimeout($pipes[1], 30000); + $stdout = self::readOrTimeout($pipes[1], self::EXIFTOOL_TIMEOUT); fclose($pipes[1]); fclose($pipes[2]); proc_terminate($proc); @@ -269,7 +270,7 @@ class Exif stream_set_blocking($pipes[1], false); try { - return self::readOrTimeout($pipes[1], 5000); + return self::readOrTimeout($pipes[1], self::EXIFTOOL_TIMEOUT); } catch (\Exception $ex) { error_log("Exiftool timeout: [{$path}]"); @@ -393,7 +394,7 @@ class Exif $readyToken = "\n{ready}\n"; try { - $buf = self::readOrTimeout(self::$staticPipes[1], 5000, $readyToken); + $buf = self::readOrTimeout(self::$staticPipes[1], self::EXIFTOOL_TIMEOUT, $readyToken); $tokPos = strrpos($buf, $readyToken); $buf = substr($buf, 0, $tokPos); @@ -416,7 +417,7 @@ class Exif stream_set_blocking($pipes[1], false); try { - $stdout = self::readOrTimeout($pipes[1], 5000); + $stdout = self::readOrTimeout($pipes[1], self::EXIFTOOL_TIMEOUT); return self::processStdout($stdout); } catch (\Exception $ex) {