Last active
May 17, 2019 03:13
-
-
Save kylemanna/3b78b94e1ae85b3ff4ca34c33fb3bd34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#export GIT_TRACE=1 | |
#export GIT_CURL_VERBOSE=1 | |
set -ex | |
lfs_explode() { | |
cd "$i" | |
while true; do | |
echo "Starting git fetch $BASHPID" | |
rm -rf .git/lfs | |
git lfs fetch 2>&1 || break | |
echo "Completed git fetch $BASHPID" | |
done | |
echo | |
echo | |
echo EXITED $BASHID | |
exit 1 | |
} | |
repo=$1 | |
cnt=${2:-2} | |
dest=$(basename $repo) | |
trap "killall background" EXIT | |
if [ ! -d $dest ]; then | |
git clone --depth 1 $repo $dest | |
fi | |
work=() | |
for i in $(seq $cnt); do | |
work+=("${dest}${i}") | |
done | |
for i in ${work[*]}; do | |
echo Fixing $i | |
rm -rf ${i} | |
cp -al ${dest} ${i} | |
git -C ${i} config lfs.transfer.maxretries 10 | |
git -C ${i} lfs env | |
git --no-pager -C ${i} config -l | |
lfs_explode "$i" & | |
done | |
time wait -n | |
killall background | |
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Bitbucket appears to rate limit ssh connections, launch several connections | |
# that repeatedly connect to ssh and exit until each returns a bad status. | |
#export GIT_TRACE_PACKET=1 | |
#export GIT_TRACE=1 | |
#export GIT_SSH_COMMAND="ssh -vvv" | |
#export GIT_CURL_VERBOSE=1 | |
spin_bitbucket() { | |
i=0 | |
t0=$(date +%s.%N) | |
while true; do | |
ssh -Tvvv git@bitbucket.org || break | |
t1=$(date +%s.%N) | |
i=$(($i + 1)) | |
rate=$(echo "scale=3; $i/($t1 - $t0)" | bc) | |
echo ":: $(date) $0($BASHPID): iteration $i, rate = $rate req/s" | |
done | |
} | |
trap "killall background" EXIT | |
# Default to 5 parallel processes | |
cnt=${1:-5} | |
for i in $(seq $cnt); do | |
spin_bitbucket & | |
done | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Update, bitbucket wasn't an issue, a Palo Alto Network Firewall had overly aggressive application settings. Sigh.