From ef7e2b8b5dc6e63b98a77c795f9ece7ea46e7828 Mon Sep 17 00:00:00 2001 From: Kai Hendry Date: Mon, 14 Jul 2014 01:07:29 +0800 Subject: [PATCH] Do not make CGI wait. Background the fetch job. Closes #44 --- create.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/create.php b/create.php index 7a88784..ccffaa5 100755 --- a/create.php +++ b/create.php @@ -21,7 +21,7 @@ if(empty($id)) { Attempting to update $id"; + echo "

Attempting to update $id

"; } else { if (!mkdir("u/$id", 0777, true)) { die("Failed to create u/$id directory."); @@ -38,8 +38,9 @@ echo "

Goto echo "

Goto http://$id.$HTTP_HOST to grep!

"; } -symlink ("$id.txt.gz", "tweets.txt.gz"); echo `sed -e "s,TIMESTAMP,$(date)," ../../greptweet.appcache > greptweet.appcache`; -echo "
";
-echo `../../fetch-tweets.sh $id & disown`;
+$logfile = "fetch-" . time() . ".log";
+exec(sprintf("../../fetch-tweets.sh %s > %s 2>&1 &", $id, $logfile));
+?>
+

Fetching tweets can take time! And it's limited by Twitter to 3200 maximum at any one time. Please view the >logfile to see it's progress.