From 9a09be3fa83e402038326e8426665fa94d73273d Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 9 Jul 2022 23:13:39 -0500 Subject: Cache results --- thesauracles | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/thesauracles b/thesauracles index 3891d18..aafa3c8 100755 --- a/thesauracles +++ b/thesauracles @@ -16,9 +16,12 @@ wf=/tmp/thesauracles hops=3 query() { - response="$(mktemp /tmp/thesauracles.XXXXXX)" - trap "rm -f $response" KILL - curl "dict://$dict_server/d:$1:$dict_database" >"$response" 2>/dev/null + response="/tmp/$1.thesauracles" + if [ ! -f "$response" ]; then + curl "dict://$dict_server/d:$1:$dict_database" >"$response" 2>/dev/null + else + sleep 0.3 + fi if grep -q 552 "$response"; then return 1 fi -- cgit 1.4.1-21-gabe81