HF RL Explorer

API rate limiting: implement stub

API rate limiting: implement stub: a task in smol-software-harbor (Harbor dataset). Implement bucket take in src/bucket.c as documented in src/bucket.h : refill the bucket for the time elapsed since the last refill (capped at the capacity; a clock that goes backwards adds nothing), then take cost…

The task

Implement `bucket_take` in `src/bucket.c` as documented in `src/bucket.h`: refill the bucket for the time elapsed since the last refill (capped at the capacity; a clock that goes backwards adds nothing), then take `cost` tokens and return 1 if there are enough, otherwise return 0 and leave the tokens unchanged. Run…

Part of efederici/smol-software-harbor.