Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14076075
D19152.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19152.diff
View Options
diff --git a/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php b/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php
--- a/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php
+++ b/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php
@@ -18,6 +18,13 @@
'param' => 'id',
'help' => pht('Build Target ID to attach the log to.'),
),
+ array(
+ 'name' => 'rate',
+ 'param' => 'bytes',
+ 'help' => pht(
+ 'Limit the rate at which the log is written, to test '.
+ 'live log streaming.'),
+ ),
));
}
@@ -54,7 +61,37 @@
pht('Reading log content from stdin...'));
$content = file_get_contents('php://stdin');
- $log->append($content);
+
+ $rate = $args->getArg('rate');
+ if ($rate) {
+ if ($rate <= 0) {
+ throw new Exception(
+ pht(
+ 'Write rate must be more than 0 bytes/sec.'));
+ }
+
+ echo tsprintf(
+ "%s\n",
+ pht('Writing log, slowly...'));
+
+ $offset = 0;
+ $total = strlen($content);
+ $pieces = str_split($content, $rate);
+
+ $bar = id(new PhutilConsoleProgressBar())
+ ->setTotal($total);
+
+ foreach ($pieces as $piece) {
+ $log->append($piece);
+ $bar->update(strlen($piece));
+ sleep(1);
+ }
+
+ $bar->done();
+
+ } else {
+ $log->append($content);
+ }
echo tsprintf(
"%s\n",
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
@@ -492,7 +492,7 @@
'UPDATE %T SET
chunk = CONCAT(chunk, %B),
size = %d,
- tailOffset = headOffset + %d,
+ tailOffset = headOffset + %d
WHERE
id = %d',
$chunk_table,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 2:37 PM (19 h, 12 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6775142
Default Alt Text
D19152.diff (2 KB)
Attached To
Mode
D19152: Add a "--rate" flag to `bin/harbormaster write-log` to support testing live log streaming
Attached
Detach File
Event Timeline
Log In to Comment