maxisoft / ASFFreeGames

Collect free steam games while asf is running
GNU Affero General Public License v3.0
122 stars 2 forks source link

Remember the activation status of games so as not to try to activate them next time #4

Closed lzrdblzzrd closed 1 year ago

lzrdblzzrd commented 1 year ago

Is your feature request related to a problem? Please describe. I would really like to see functionality that would write AccessDenied/InvalidPackage and Fail/AlreadyPurchased errors to the file, since the plugin constantly checks for new free games and tries to add to the account those games whose activation gave an error. Because of this, logs are overflowing with the same type of messages:

2022-10-22 03:07:17|dotnet-19|INFO|ASF|CollectGames() [FreeGames] <*account name*> ID: app/489520 | Status: Fail/AlreadyPurchased
2022-10-22 03:37:20|dotnet-19|INFO|ASF|CollectGames() [FreeGames] <*account name*> ID: app/489520 | Status: Fail/AlreadyPurchased
2022-10-22 04:07:17|dotnet-19|INFO|ASF|CollectGames() [FreeGames] <*account name*> ID: app/489520 | Status: Fail/AlreadyPurchased
2022-10-22 04:37:25|dotnet-19|INFO|ASF|CollectGames() [FreeGames] <*account name*> ID: app/489520 | Status: Fail/AlreadyPurchased
2022-10-22 05:37:40|dotnet-19|INFO|ASF|CollectGames() [FreeGames] <*account name*> ID: app/489520 | Status: Fail/AlreadyPurchased

Describe the solution you'd like For example, if activation would have given an error, write to the file those AppIDs that would not have been activated in the next day/week, so as not to give this error every time.

Additional context I do not know if the functionality of plugins allows you to create files and write such information to them (I'm talking about what was proposed in Describe the solution you'd like), but if it is possible, it would be very good to have it implemented. Thanks.

maxisoft commented 1 year ago

Indeed the plugin may spam logs when the collecting games process fails due to current implementation.
In the next version of this plugin I'll reduce the amount of logs written in such case.

For example, if activation would have given an error, write to the file those AppIDs that would not have been activated in the next day/week, so as not to give this error every time.

The plugin does already mitigate logs spam issues by only trying to add a license for a game 5 times a day (or until the next app restart). In the current version the plugin blindly log those tries.

But I will not try to silence the InternalRequest() InternalServerError <- POST https://store.steampowered.com/checkout/addfreelicense nor UrlPostToJsonObject() Request failed after 5 attempts! log entries (not listed in original post issue) because those entries are from ASF/Steamkit (out of my control without hacky code).
Also I'll not change the plugin logic (the addlicence tryharding) too much to avoid those 2 log entries (the 2 from ASF/Steamkit) because that would make the overall logic less resilient to external errors.
For instance one may list a game as free on reddit 1 minute before the game being effectivelly free on some region. Blacklisting the game forever/toolong (and thus preventing the plugin to collect the game) in order to avoid just some anoying log lines isn't worth it.

So, as a compromise, I choose to only silent the spammy duplicated logs in my controll. Which mean the duplicated log line shown in the issue would occurs only once.


I do not know if the functionality of plugins allows you to create files and write such information to them (I'm talking about what was proposed in Describe the solution you'd like), but if it is possible, it would be very good to have it implemented. Thanks.

Yes ASF plugins have access to this functionality and in fact the plugin already use files (the config/<BOTNAME>.fgldict files) to only store successfully added app. In the next release I use those files to store the addlicense failed state also.

lzrdblzzrd commented 1 year ago

Thank you for taking it. I will be waiting for an update.

maxisoft commented 1 year ago

Closing as V1.2.7 address the issue.

I decided to handle both Status: Fail/AlreadyPurchased and InternalRequest() InternalServerError kindof log entries. Those log entries would appear only once for a given game title (Preventing the log files to be full of this kind of errors).