multi-acc rate limited lookin pretty good~
Some checks failed
cicd / ci (push) Failing after 14s

This commit is contained in:
Bel LaPointe
2025-05-23 23:17:54 -06:00
parent 284613b5bc
commit b10283d752
10 changed files with 562 additions and 1 deletions

View File

@@ -7,11 +7,14 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"strings"
"time"
"gogs.inhome.blapointe.com/ana-ledger/src/bank"
"golang.org/x/time/rate"
)
type Client struct {
@@ -55,7 +58,14 @@ func (c Client) Transactions(ctx context.Context, a bank.Account) ([]bank.Transa
return result, err
}
var limiter = rate.NewLimiter(0.1, 1)
func (c Client) get(ctx context.Context, url, token string, ptr interface{}) error {
if err := limiter.Wait(ctx); err != nil {
return err
}
log.Printf("Teller.Get(%s, %s)", url, token)
httpc := &http.Client{
Timeout: time.Second,
Transport: &http.Transport{

View File

@@ -1 +1,3 @@
token_2utqstwpn3pxwgvyno56hqdehq
token_vr6dnzvfv7c24wuxtmnnzyiqbm
token_r4pbocuwhxoorjiag67rq4zen4

View File

@@ -13,7 +13,7 @@ type Account struct {
} `json:"institution"`
Name string `json:"last_four"`
Account string `json:"id"`
Token string `json:"-"`
Token string `json:"__token"`
}
type Transaction struct {