Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exchanges/request: abstract and consolidate rate limiting code to request package #1477

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

shazbert
Copy link
Collaborator

@shazbert shazbert commented Feb 13, 2024

PR Description

Pulled from initial draft #1151

  • Allows context cancellation to occur while routine is being rate limited for any outbound REST request
  • Reduces wrapper code size and bespoke implementations
  • Fixes a couple of endpoints defaulting to unauth rates [BUG]

Type of change

Please delete options that are not relevant and add an x in [] as item is complete.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and
also consider improving test coverage whilst working on a certain feature or package.

  • go test ./... -race
  • golangci-lint run
  • Test X

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation and regenerated documentation via the documentation tool
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally and on Github Actions with my changes
  • Any dependent changes have been merged and published in downstream modules

@shazbert shazbert added the review me This pull request is ready for review label Feb 13, 2024
@shazbert shazbert requested a review from a team February 13, 2024 00:10
@shazbert shazbert self-assigned this Feb 13, 2024
@shazbert shazbert added the reconstructing Based on PR feedback, this is currently being reworked and is not to be merged label Apr 30, 2024
@shazbert shazbert removed the reconstructing Based on PR feedback, this is currently being reworked and is not to be merged label May 1, 2024
@shazbert shazbert requested a review from gloriousCode May 1, 2024 00:15
@shazbert shazbert added the bug label May 1, 2024
Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Only basic things that I could see.

exchanges/request/limit.go Outdated Show resolved Hide resolved
exchanges/binance/ratelimit.go Outdated Show resolved Hide resolved
exchanges/binance/ratelimit.go Outdated Show resolved Hide resolved
exchanges/bybit/ratelimit.go Outdated Show resolved Hide resolved
exchanges/request/limit.go Outdated Show resolved Hide resolved
exchanges/request/limit.go Outdated Show resolved Hide resolved
@shazbert shazbert requested a review from gloriousCode May 1, 2024 05:14
Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making those changes!

exchanges/bitfinex/ratelimit.go Outdated Show resolved Hide resolved
exchanges/binance/ratelimit_test.go Show resolved Hide resolved
Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK! rate limiter still functioning
image
(rate limit at 1.991s with all pairs enabled)

@gloriousCode gloriousCode added the gcrc GloriousCode Review Complete label May 7, 2024
Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 95.55215% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 35.97%. Comparing base (34ef09d) to head (e4ca46c).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1477      +/-   ##
==========================================
+ Coverage   35.89%   35.97%   +0.07%     
==========================================
  Files         409      409              
  Lines      177453   176414    -1039     
==========================================
- Hits        63699    63464     -235     
+ Misses     105899   105101     -798     
+ Partials     7855     7849       -6     
Files Coverage Δ
currency/coinmarketcap/coinmarketcap.go 55.33% <100.00%> (ø)
exchanges/binance/binance_cfutures.go 33.55% <100.00%> (ø)
exchanges/binance/binance_wrapper.go 38.45% <100.00%> (-0.08%) ⬇️
exchanges/binance/ratelimit.go 96.51% <100.00%> (+30.32%) ⬆️
exchanges/binance/type_convert.go 56.36% <ø> (+2.76%) ⬆️
exchanges/binanceus/binanceus_wrapper.go 40.89% <100.00%> (ø)
exchanges/binanceus/ratelimit.go 84.84% <100.00%> (+35.64%) ⬆️
exchanges/bitfinex/bitfinex_wrapper.go 37.95% <100.00%> (+0.09%) ⬆️
exchanges/bitfinex/ratelimit.go 100.00% <100.00%> (+53.33%) ⬆️
exchanges/bitflyer/bitflyer.go 50.31% <100.00%> (ø)
... and 47 more

... and 9 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug gcrc GloriousCode Review Complete medium priority review me This pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants