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

Add adjustable delay between market actions #220

Merged
merged 20 commits into from
Aug 12, 2024

Conversation

Sadzurami
Copy link
Contributor

Steam changed rate limits on various endpoints, including market

Would be cool to see adjustable delay between market actions

ref: #219

@Sadzurami
Copy link
Contributor Author

Sadzurami commented Jul 25, 2024

To be honest, i'm not sure is it worth to apply this delays for price loading requests, or not

Personally i saw rate limits for selling items and removing listings, but not for price loading.. but steam is steam, really don't know what will be better

@Sadzurami
Copy link
Contributor Author

Sadzurami commented Jul 25, 2024

I removed delays for prices load for now

If someone will see limits for that, will be easy to apply delays back

code.user.js Outdated Show resolved Hide resolved
@xPaw
Copy link
Contributor

xPaw commented Jul 26, 2024

Do you know which calls trigger the rate limit (is it 429 response)? If so, would be good to detect specifically that and increase the delay greatly and/or alert the user somehow.

@Sadzurami
Copy link
Contributor Author

Sadzurami commented Jul 26, 2024

Do you know which calls trigger the rate limit (is it 429 response)? If so, would be good to detect specifically that and increase the delay greatly and/or alert the user somehow.

https://steamcommunity.com/market/removelisting/:id
https://steamcommunity.com/market/sellitem/

429 http code

maybe even (not sure)
https://steamcommunity.com/market/cancelbuyorder/

but i don't think increasing delays after limits is good idea, because we don't know when will be next limits window

@xPaw
Copy link
Contributor

xPaw commented Jul 26, 2024

If a 429 is hit, there's no point even trying to send a request (especially with a user configured delay), you can force next request to be delayed by like 2 minutes or whatever the rate limit is.

@Sadzurami
Copy link
Contributor Author

If a 429 is hit, there's no point even trying to send a request (especially with a user configured delay), you can force next request to be delayed by like 2 minutes or whatever the rate limit is.

made some changes
please, check it, if you have some time

code.user.js Outdated Show resolved Hide resolved
@Sadzurami
Copy link
Contributor Author

Sadzurami commented Jul 26, 2024

It seems that Steam is throttling other /market/ requests too (I checked myself).
So I return delays back to price and listings loading requests.

code.user.js Outdated Show resolved Hide resolved
@Sadzurami
Copy link
Contributor Author

Sadzurami commented Jul 29, 2024

made some tweaks which will be better for handling rate-limits and writing less code

also made some refactor things on sellQueue and some other queues

@Nuklon
Copy link
Owner

Nuklon commented Aug 1, 2024

Thanks for this PR, I think a fix for throttling is OK, but I don't see any point in adding a configurable setting.
It should:

  • Use a timeout that doesn't cause throttling.
  • Delay requests after being throttled (similar to what @xPaw said).

@Sadzurami
Copy link
Contributor Author

Sadzurami commented Aug 1, 2024

Thanks for this PR, I think a fix for throttling is OK, but I don't see any point in adding a configurable setting. It should:

  • Use a timeout that doesn't cause throttling.
  • Delay requests after being throttled (similar to what @xPaw said).

Agree with you.
The main purpose of having configurable setting is #219.

Also, we don't know exact steam limits. I guess 1 second between requests will be enough, and i tested 1s and didn't see rate limits, but it's not guarantee.

And, there is possibility that steam will change limits in future, so, having configurable settings is not that bad. But, yea, for this case better to have setting not only for market request, but for all requests (now 300ms by default).

@Nuklon
Copy link
Owner

Nuklon commented Aug 1, 2024

If Steam changes it again we can release a new version to address it, I don't think this needs to be configurable as it should work out of the box.

@Sadzurami
Copy link
Contributor Author

If Steam changes it again we can release a new version to address it, I don't think this needs to be configurable as it should work out of the box.

Alr, i'll make commit with changes.

@Sadzurami
Copy link
Contributor Author

@Nuklon looks like it's done

code.user.js Outdated Show resolved Hide resolved
@Sadzurami
Copy link
Contributor Author

Sadzurami commented Aug 3, 2024

returned back localStorage to request function

it will help prevent limits, if two tabs opened at the same time, for example market and inventory

@xPaw
Copy link
Contributor

xPaw commented Aug 3, 2024

That's my bad, I thought sessionStorage was shared between tabs.

@Sadzurami
Copy link
Contributor Author

@Nuklon please, take a look to this pr request

code.user.js Outdated Show resolved Hide resolved
@Nuklon Nuklon merged commit aa7e9b8 into Nuklon:master Aug 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants