Skip to content

Commit 6c24663

Browse files
authored
Merge pull request #324 from ErikKalkoken/feat-asset-rate-limit
feat: enable asset rate limits
2 parents 83d8d73 + 071feda commit 6c24663

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+187
-137
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ EVE Buddy.exe
1818
playground/
1919
**/testdata/failed
2020
test.db
21+
ratelimits.md

FyneApp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Website = "https://github.com/ErikKalkoken/evebuddy"
44
Icon = "icon.png"
55
Name = "EVE Buddy"
66
ID = "io.github.erikkalkoken.evebuddy"
7-
Version = "0.49.0"
7+
Version = "0.50.0"
88
Build = 0
99

1010
[Release]

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mapping:
1212
gofmt -s -w internal/eveicon/mapping.go
1313
go run ./tools/genschematicids/ -p eveicon > internal/eveicon/schematic.go
1414
gofmt -s -w internal/eveicon/schematic.go
15-
go run ./tools/genratelimit/ -p xesi > internal/xesi/ratelimit_gen.go
15+
go run ./tools/genratelimit/ -p xgoesi > internal/xgoesi/ratelimit_gen.go
1616

1717
queries:
1818
sqlc generate
@@ -54,3 +54,6 @@ test_races:
5454

5555
build:
5656
fyne build --tags migrated_fynedo
57+
58+
ratelimitdoc:
59+
go run ./tools/genratelimit/ -f md > ratelimits.md

internal/app/characterservice/assets.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1515
"github.com/ErikKalkoken/evebuddy/internal/optional"
1616
"github.com/ErikKalkoken/evebuddy/internal/set"
17-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
17+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1818
esioptional "github.com/antihax/goesi/optional"
1919
)
2020

@@ -54,8 +54,8 @@ func (s *CharacterService) updateAssetsESI(ctx context.Context, arg app.Characte
5454
return s.updateSectionIfChanged(
5555
ctx, arg,
5656
func(ctx context.Context, characterID int32) (any, error) {
57-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdAssets")
58-
assets, err := xesi.FetchPages(
57+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdAssets")
58+
assets, err := xgoesi.FetchPages(
5959
func(pageNum int) ([]esi.GetCharactersCharacterIdAssets200Ok, *http.Response, error) {
6060
arg := &esi.GetCharactersCharacterIdAssetsOpts{
6161
Page: esioptional.NewInt32(int32(pageNum)),
@@ -273,7 +273,7 @@ func (s *CharacterService) updateAssetsESI(ctx context.Context, arg app.Characte
273273
func (s *CharacterService) fetchAssetNamesESI(ctx context.Context, characterID int32, ids []int64) (map[int64]string, error) {
274274
const assetNamesMaxIDs = 999
275275
results := make([][]esi.PostCharactersCharacterIdAssetsNames200Ok, 0)
276-
ctx = xesi.NewContextWithOperationID(ctx, "PostCharactersCharacterIdAssetsNames")
276+
ctx = xgoesi.NewContextWithOperationID(ctx, "PostCharactersCharacterIdAssetsNames")
277277
for chunk := range slices.Chunk(ids, assetNamesMaxIDs) {
278278
names, _, err := s.esiClient.ESI.AssetsApi.PostCharactersCharacterIdAssetsNames(ctx, characterID, chunk, nil)
279279
if err != nil {

internal/app/characterservice/character.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1313
"github.com/ErikKalkoken/evebuddy/internal/optional"
1414
"github.com/ErikKalkoken/evebuddy/internal/set"
15-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
15+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1616
"github.com/ErikKalkoken/evebuddy/internal/xiter"
1717
)
1818

@@ -192,7 +192,7 @@ func (s *CharacterService) UpdateOrCreateCharacterFromSSO(ctx context.Context, s
192192
Scopes: set.Of(ssoToken.Scopes...),
193193
TokenType: ssoToken.TokenType,
194194
}
195-
ctx = xesi.NewContextWithAuth(ctx, token.CharacterID, token.AccessToken)
195+
ctx = xgoesi.NewContextWithAuth(ctx, token.CharacterID, token.AccessToken)
196196
character, _, err := s.eus.UpdateOrCreateCharacterESI(ctx, token.CharacterID)
197197
if err != nil {
198198
return nil, err
@@ -234,7 +234,7 @@ func (s *CharacterService) updateLocationESI(ctx context.Context, arg app.Charac
234234
return s.updateSectionIfChanged(
235235
ctx, arg,
236236
func(ctx context.Context, characterID int32) (any, error) {
237-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdLocation")
237+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdLocation")
238238
location, _, err := s.esiClient.ESI.LocationApi.GetCharactersCharacterIdLocation(ctx, characterID, nil)
239239
if err != nil {
240240
return false, err
@@ -270,7 +270,7 @@ func (s *CharacterService) updateOnlineESI(ctx context.Context, arg app.Characte
270270
return s.updateSectionIfChanged(
271271
ctx, arg,
272272
func(ctx context.Context, characterID int32) (any, error) {
273-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdOnline")
273+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdOnline")
274274
online, _, err := s.esiClient.ESI.LocationApi.GetCharactersCharacterIdOnline(ctx, characterID, nil)
275275
if err != nil {
276276
return false, err
@@ -293,7 +293,7 @@ func (s *CharacterService) updateShipESI(ctx context.Context, arg app.CharacterS
293293
return s.updateSectionIfChanged(
294294
ctx, arg,
295295
func(ctx context.Context, characterID int32) (any, error) {
296-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdShip")
296+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdShip")
297297
ship, _, err := s.esiClient.ESI.LocationApi.GetCharactersCharacterIdShip(ctx, characterID, nil)
298298
if err != nil {
299299
return false, err
@@ -320,7 +320,7 @@ func (s *CharacterService) updateWalletBalanceESI(ctx context.Context, arg app.C
320320
return s.updateSectionIfChanged(
321321
ctx, arg,
322322
func(ctx context.Context, characterID int32) (any, error) {
323-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdWallet")
323+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdWallet")
324324
balance, _, err := s.esiClient.ESI.WalletApi.GetCharactersCharacterIdWallet(ctx, characterID, nil)
325325
if err != nil {
326326
return false, err

internal/app/characterservice/clones.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1313
"github.com/ErikKalkoken/evebuddy/internal/optional"
1414
"github.com/ErikKalkoken/evebuddy/internal/set"
15-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
15+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1616
"github.com/antihax/goesi/esi"
1717
"golang.org/x/sync/errgroup"
1818
)
@@ -66,7 +66,7 @@ func (s *CharacterService) updateJumpClonesESI(ctx context.Context, arg app.Char
6666
return s.updateSectionIfChanged(
6767
ctx, arg,
6868
func(ctx context.Context, characterID int32) (any, error) {
69-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdClones")
69+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdClones")
7070
clones, _, err := s.esiClient.ESI.ClonesApi.GetCharactersCharacterIdClones(ctx, characterID, nil)
7171
if err != nil {
7272
return false, err

internal/app/characterservice/communications.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1212
"github.com/ErikKalkoken/evebuddy/internal/optional"
1313
"github.com/ErikKalkoken/evebuddy/internal/set"
14-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
14+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1515
"github.com/antihax/goesi/esi"
1616
"golang.org/x/sync/errgroup"
1717
)
@@ -104,7 +104,7 @@ func (s *CharacterService) updateNotificationsESI(ctx context.Context, arg app.C
104104
return s.updateSectionIfChanged(
105105
ctx, arg,
106106
func(ctx context.Context, characterID int32) (any, error) {
107-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdNotifications")
107+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdNotifications")
108108
notifications, _, err := s.esiClient.ESI.CharacterApi.GetCharactersCharacterIdNotifications(ctx, characterID, nil)
109109
if err != nil {
110110
return false, err

internal/app/characterservice/contracts.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/ErikKalkoken/evebuddy/internal/app"
1414
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1515
"github.com/ErikKalkoken/evebuddy/internal/set"
16-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
16+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1717
"github.com/ErikKalkoken/evebuddy/internal/xslices"
1818
)
1919

@@ -150,8 +150,8 @@ func (s *CharacterService) updateContractsESI(ctx context.Context, arg app.Chara
150150
return s.updateSectionIfChanged(
151151
ctx, arg,
152152
func(ctx context.Context, characterID int32) (any, error) {
153-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdContracts")
154-
contracts, err := xesi.FetchPages(
153+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdContracts")
154+
contracts, err := xgoesi.FetchPages(
155155
func(pageNum int) ([]esi.GetCharactersCharacterIdContracts200Ok, *http.Response, error) {
156156
return s.esiClient.ESI.ContractsApi.GetCharactersCharacterIdContracts(
157157
ctx, characterID, &esi.GetCharactersCharacterIdContractsOpts{
@@ -283,7 +283,7 @@ func (s *CharacterService) createNewContract(ctx context.Context, characterID in
283283
if err != nil {
284284
return err
285285
}
286-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdContractsContractIdItems")
286+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdContractsContractIdItems")
287287
items, _, err := s.esiClient.ESI.ContractsApi.GetCharactersCharacterIdContractsContractIdItems(ctx, characterID, c.ContractId, nil)
288288
if err != nil {
289289
return err

internal/app/characterservice/implants.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/ErikKalkoken/evebuddy/internal/app"
99
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1010
"github.com/ErikKalkoken/evebuddy/internal/set"
11-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
11+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1212
)
1313

1414
func (s *CharacterService) ListImplants(ctx context.Context, characterID int32) ([]*app.CharacterImplant, error) {
@@ -26,7 +26,7 @@ func (s *CharacterService) updateImplantsESI(ctx context.Context, arg app.Charac
2626
return s.updateSectionIfChanged(
2727
ctx, arg,
2828
func(ctx context.Context, characterID int32) (any, error) {
29-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdImplants")
29+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdImplants")
3030
implants, _, err := s.esiClient.ESI.ClonesApi.GetCharactersCharacterIdImplants(ctx, characterID, nil)
3131
if err != nil {
3232
return false, err

internal/app/characterservice/industry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/ErikKalkoken/evebuddy/internal/app"
1111
"github.com/ErikKalkoken/evebuddy/internal/app/storage"
1212
"github.com/ErikKalkoken/evebuddy/internal/set"
13-
"github.com/ErikKalkoken/evebuddy/internal/xesi"
13+
"github.com/ErikKalkoken/evebuddy/internal/xgoesi"
1414
"github.com/ErikKalkoken/evebuddy/internal/xiter"
1515
"github.com/antihax/goesi/esi"
1616
esioptional "github.com/antihax/goesi/optional"
@@ -43,7 +43,7 @@ func (s *CharacterService) updateIndustryJobsESI(ctx context.Context, arg app.Ch
4343
_, err := s.updateSectionIfChanged(
4444
ctx, arg,
4545
func(ctx context.Context, characterID int32) (any, error) {
46-
ctx = xesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdIndustryJobs")
46+
ctx = xgoesi.NewContextWithOperationID(ctx, "GetCharactersCharacterIdIndustryJobs")
4747
jobs, _, err := s.esiClient.ESI.IndustryApi.GetCharactersCharacterIdIndustryJobs(ctx, characterID, &esi.GetCharactersCharacterIdIndustryJobsOpts{
4848
IncludeCompleted: esioptional.NewBool(true),
4949
})

0 commit comments

Comments
 (0)