update to latest gpt model

This commit is contained in:
2025-02-01 22:57:23 -07:00
parent 91da21defb
commit b926215e94
6 changed files with 72 additions and 20 deletions

31
cmd/rateTest/rate.go Normal file
View File

@ -0,0 +1,31 @@
package main
import (
"fmt"
"sync"
"time"
)
type Rate struct {
RPM int
mu sync.Mutex
}
func main() {
r := Rate{RPM: 10}
for i := 0; i < 10; i++ {
go func(j int) {
r.RateLimit()
fmt.Println("Rate limiting")
}(i)
}
time.Sleep(time.Minute)
}
func (r *Rate) RateLimit() {
// Lock for the fraction of a minute based on RPM
r.mu.Lock()
// Unlock after the fraction of a minute
time.Sleep(time.Minute / time.Duration(r.RPM))
r.mu.Unlock()
}