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

Is it possible to force refresh for an item? #113

Open
JustArchi opened this issue Jan 19, 2019 · 1 comment
Open

Is it possible to force refresh for an item? #113

JustArchi opened this issue Jan 19, 2019 · 1 comment

Comments

@JustArchi
Copy link
Contributor

Sometimes during creating a trade offer, SEE shows infinity as a price for an item. It's obviously caused by temporary failure communicating with Steam, and that itself is alright, we're all well aware of that.

What I'm missing though is a way to force refresh of such item, which would refetch the price again and update all items of the same type. Since I'm creating a trade offer, it's very often case that let's say 9 out of 10 different item types fetch fine, but the last one won't, and since there is no way to force refresh, you need to either check and calculate manually, or refresh entire page and add your 10 item types again hoping that this time it'll work fine.

I thought about implementing it in two different ways. You could just add a button such as "Retry failed prices" on inventory and trade offer pages, which would effectively re-fetch all failed prices (but not those that were fetched successfully). Alternatively, and this probably requires more work, is adding an option to somehow refetch price only for this specific item class, maybe to the context menu provided by Steam, or somewhere else under right click or whatever.

I hope that my feature request makes sense, thank you for your work spent on this extension, and thank you in advance for considering my suggestion.

@JustArchi
Copy link
Contributor Author

JustArchi commented Jan 19, 2019

Alternatively, and probably the easiest way implementation-wise, maybe SEE could just retry the failed requests automatically after being done with the current queue? You could use a pseudocode like this (of course appropriately adapted to js):

void OnFinishedQueue() {
    if (FinishedQueue.All(item => item.ParsedSuccessfully)) {
        // Nothing to retry
        return;
    }

    if (!FinishedQueue.LastItem.ParsedSuccessfully) {
         // Very likely we got rate-limited, wait at least 30 seconds or some other timeout in order to avoid pointless infinite loop
        Sleep(30);
    }

    OngoingQueue.Clear();
    OngoingQueue.Add(FinishedQueue.Where(item => !item.ParsedSuccessfully));
    FinishedQueue.Clear();

    OngoingQueue.Start();
    // Once OngoingQueue is finished, it'll call OnFinishedQueue() again with results available as FinishedQueue
}

I don't see any potential drawbacks to this, and implementation should be easy enough with no required UI updates. There is always a case where we could run into potential infinite loop with some unparsable item type, but then the delay will do the job, and we can always gradually multiply the delay by 2 each retry.

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

No branches or pull requests

1 participant