repo=$(req 'select FROM_UNIXTIME(r.epoch), r.syncWait, r.repositoryPHID, a.name from repository_syncevent as r, phabricator_almanac.almanac_device as a where r.properties like "%lock%" and r.devicePHID=a.phid group by r.repositoryPHID,a.name order by epoch desc limit 10;;' | tail -n +2)
if[ -z "$repo"]; then echo"Nothing to do.. exiting"; exit; fi
while read -r r; do
TS=$(echo"$r" | cut -f1 | jq -r '.epoch')
if[$TS -lt $(($(date +%s)-300))]; then# older than 5 minutes