Vectrum
Sign In
15 lines · 338 Bytes · Shell
#!/usr/bin/env bash
set -euo pipefail
python3 - <<'PY'
p='internal/ratelimit/bucket.go'
s=open(p).read()
s=s.replace("""	b.tokens += elapsed * b.rate
	if b.tokens > b.capacity {
		b.tokens = b.capacity
	}""","""	b.tokens += elapsed * b.rate
	if b.tokens > b.capacity {
		b.tokens = b.capacity
	}
	b.last = now""")
open(p,'w').write(s)
PY