Steam-Economy-Enhancer icon indicating copy to clipboard operation
Steam-Economy-Enhancer copied to clipboard

Is it possible to force refresh for an item?

Open JustArchi opened this issue 5 years ago • 1 comments

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 avatar Jan 19 '19 02:01 JustArchi

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.

JustArchi avatar Jan 19 '19 02:01 JustArchi