Nuklon / Steam-Economy-Enhancer

Enhances the Steam Inventory and Steam Market.
MIT License
1.59k stars 181 forks source link

Add adjustable delay between market actions #220

Closed Sadzurami closed 2 months ago

Sadzurami commented 3 months ago

Steam changed rate limits on various endpoints, including market

Would be cool to see adjustable delay between market actions

ref: https://github.com/Nuklon/Steam-Economy-Enhancer/issues/219

Sadzurami commented 3 months ago

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 commented 3 months ago

I removed delays for prices load for now

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

xPaw commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

Sadzurami commented 3 months ago

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

Sadzurami commented 3 months ago

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 commented 3 months ago

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:

Sadzurami commented 3 months ago

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 https://github.com/Nuklon/Steam-Economy-Enhancer/issues/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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

@Nuklon looks like it's done

Sadzurami commented 3 months ago

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 commented 3 months ago

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

Sadzurami commented 2 months ago

@Nuklon please, take a look to this pr request