jenkins-bot has submitted this change and it was merged.
Change subject: Make GetLocalFileCopy pool counter call from tiff be generic
......................................................................
Make GetLocalFileCopy pool counter call from tiff be generic
I was to make PagedTiffHandler subclass TransformationalImageHandler.
The biggest thing that's different is the pool counter call.
However, given that a file is just as expensive in terms of
network bandwidth regardless of its type, seems to make sense
to make this check generic.
Change-Id: I7e4a4769edaa4742803df407b9c719c54fb77de3
---
M includes/filerepo/file/File.php
1 file changed, 17 insertions(+), 1 deletion(-)
Approvals:
Reedy: Looks good to me, approved
jenkins-bot: Verified
Objections:
Gilles: There's a problem with this change, please improve
diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index f9e0a2d..11a3e5c 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -1231,9 +1231,25 @@
}
}
+ // Thumbnailing a very large file could result in network
saturation if
+ // everyone does it at once.
+ if ( $this->getSize() >= 1e7 ) { // 10MB
+ $that = $this;
+ $work = new PoolCounterWorkViaCallback(
'GetLocalFileCopy', sha1( $this->getName() ),
+ array(
+ 'doWork' => function() use ( $that ) {
+ return $that->getLocalRefPath();
+ }
+ )
+ );
+ $srcPath = $work->execute();
+ } else {
+ $srcPath = $this->getLocalRefPath();
+ }
+
// Original file
return array(
- 'path' => $this->getLocalRefPath(),
+ 'path' => $srcPath,
'width' => $this->getWidth(),
'height' => $this->getHeight()
);
--
To view, visit https://gerrit.wikimedia.org/r/149791
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7e4a4769edaa4742803df407b9c719c54fb77de3
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits