[dpdk-ci] [PATCH v2 10/10] tools: skip the IDs we already fetched

alialnu at oss.nvidia.com alialnu at oss.nvidia.com
Tue Sep 21 16:35:42 CEST 2021


From: Ali Alnubani <alialnu at nvidia.com>

Store the IDs we already fetched in a file and don't
run 'callcmd' again for them.

Signed-off-by: Ali Alnubani <alialnu at nvidia.com>
---
 tools/poll-pw | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/poll-pw b/tools/poll-pw
index e197a91..dacf34b 100755
--- a/tools/poll-pw
+++ b/tools/poll-pw
@@ -65,6 +65,11 @@ if [ ! $? -eq 0 ] ; then
 	exit 1
 fi
 
+poll_pw_ids_file=/tmp/poll_pw_${resource_type}_ids
+if [ ! -f "$poll_pw_ids_file" ] ; then
+	touch $poll_pw_ids_file
+fi
+
 URL="${URL}/${resource_type}/?project=${project}&"
 
 callcmd () # <patchwork id>
@@ -77,7 +82,11 @@ while true ; do
 	date_now=$(date '+%FT%T')
 	since=$(date -d $(cat $since_file | tr '\n' ' ') '+%FT%T')
 	for id in $(curl -s "${URL}since=${since}" | jq '.[].id') ; do
+		if grep -q "^${id}$" $poll_pw_ids_file ; then
+			continue
+		fi
 		callcmd $id
+		echo $id >>$poll_pw_ids_file
 	done
 	echo -n $date_now >$since_file
 	# pause before next check
-- 
2.25.1



More information about the ci mailing list