[dpdk-ci] [PATCH v4 10/10] tools: skip the IDs we already fetched
Ali Alnubani
alialnu at nvidia.com
Mon Nov 8 07:28:15 CET 2021
To avoid calling 'callcmd' more than once for an ID, which can happen
if a Patchwork ID was created between recording 'date_now' and fetching
the API, store the IDs we already fetched in a file and don't run 'callcmd'
again for any ID that exists in the file while keeping the number of
entries less than 1000 in that file.
Signed-off-by: Ali Alnubani <alialnu at nvidia.com>
---
Changes in v4:
- Limit the number of lines in poll_pw_ids_file (Suggested by Thomas Monjalon).
tools/poll-pw | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/poll-pw b/tools/poll-pw
index f4b89c7..dd19016 100755
--- a/tools/poll-pw
+++ b/tools/poll-pw
@@ -66,6 +66,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}/events/?category=${resource_type}-completed"
callcmd () # <patchwork id>
@@ -84,11 +89,19 @@ while true ; do
| jq "try ( .payload.${resource_type}.id )")
[ -z "$(echo $ids | tr -d '\n')" ] && break
for id in $ids ; do
+ if grep -q "^${id}$" $poll_pw_ids_file ; then
+ continue
+ fi
callcmd $id
+ echo $id >>$poll_pw_ids_file
done
page=$((page+1))
done
echo -n $date_now >$since_file
+ # keep only up to 1000 entries in poll_pw_ids_file
+ if [ $(wc -l <$poll_pw_ids_file) -ge 1000 ] ; then
+ echo "$(tail -500 $poll_pw_ids_file)" >$poll_pw_ids_file
+ fi
# pause before next check
sleep $PAUSE_SECONDS
done
--
2.25.1
More information about the ci
mailing list