This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Queue worker daemon | |
*/ | |
require_once __DIR__ . '/vendor/autoload.php'; | |
// Throw an exception for all warnings, notices, etc. | |
function handle_err($errNo, $errStr, $errFile, $errLine) | |
{ | |
throw new ErrorException("$errStr in $errFile on line $errLine", $errNo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Daemon process template | |
*/ | |
// Throw an exception for all warnings, notices, etc. | |
function handle_err($errNo, $errStr, $errFile, $errLine) | |
{ | |
throw new ErrorException("$errStr in $errFile on line $errLine", $errNo); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Testing shutdown sequence | |
// Adapted from https://evertpot.com/160/ | |
ob_start( | |
function($buffer) { | |
return $buffer . "output buffer flushed\n"; | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, pg_size_pretty(total_bytes) AS total | |
, pg_size_pretty(index_bytes) AS INDEX | |
, pg_size_pretty(toast_bytes) AS toast | |
, pg_size_pretty(table_bytes) AS TABLE | |
FROM ( | |
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM ( | |
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME | |
, c.reltuples AS row_estimate | |
, pg_total_relation_size(c.oid) AS total_bytes | |
, pg_indexes_size(c.oid) AS index_bytes |