Skip already queued url downloads 38/181838/1
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 26 Sep 2017 12:58:33 +0000 (14:58 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Mon, 16 Oct 2017 11:21:47 +0000 (13:21 +0200)
Also update killer to use "-k" instead of kill `tsp -p`.

Change-Id: I8e2c61cc1b6e212fa72217cf5bc6ed1a23f2df84

tsp/jobs/trigger_downloads.sh

index 15bdabc..981e6be 100755 (executable)
@@ -66,7 +66,12 @@ do
     test -n "${url}" || continue
     echo "Processing: ${url}"
     # kill currently running jobs for this url
-    for i in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}'); do kill "$(tsmaster -p "$i")"; done
+    for i in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}'); do tsmaster -k "$i"; done
+    # skip url if a job is already queued
+    test -z "$(tsmaster | awk -v URL="$url" '$2 ~ "queued" && $0 ~ URL {print $1}')" || {
+        echo "download is already queued. skipping..."
+        continue
+    }
     next=$((next+1))
     dwn_next="${next}"
     # prepare download directory