@@ -24,9 +24,13 @@ $raw_data = file_get_contents('php://input');
include 'settings-h2r.php';
$redis = new Redis();
-$redis->pconnect($redis_host, $redis_port);
+$rv = $redis->pconnect($redis_host, $redis_port);
-# TODO: check for return value of FALSE and then print raw_data and return !200
+if (!$rv) {
+ error_log("ERROR 1a in Redis connect at $time - cannot save $raw_data");
+ http_response_code(503); # Service Unavailable
+ exit(0);
+}
if (!empty($redis_auth)) {
# TODO: check return value to confirm login succeeded
@@ -37,12 +41,14 @@ if (!empty($redis_auth)) {
$time2 = microtime(true);
-$redis->lPush('incoming_messages-'.'test1a', # TODO: update queue name
+$rv = $redis->lPush('incoming_messages-'.'test1a', # TODO: update queue name
'"ts_020-first_db_hit":'.$time2.',"ts_010-first_received":'.$time.',"MSG":'.$raw_data);
-# TODO: check for return value of FALSE and then print raw_data and return !200--# TODO: test syntax error to ensure non-200 is returned
+if (!$rv) {
+ error_log("ERROR 2a in lPush at $time $time2 - cannot save $raw_data");
+ http_response_code(503); # Service Unavailable
+ exit(0);
+}
print 'ok';