Commit Graph

55 Commits

Author SHA1 Message Date
JustArchi
2997f857d5 Misc 2018-03-24 18:06:09 +01:00
JustArchi
a5cf0fc694 Improve statistics code 2018-03-24 17:14:01 +01:00
JustArchi
295c4d669c ArchiBoT/ASF code unification 2018-03-09 23:48:47 +01:00
JustArchi
ac35ff3455 Move ASF statistics to new API address 2018-02-21 17:47:17 +01:00
JustArchi
9d121acd43 Add games count to ASF statistics 2018-02-21 17:44:06 +01:00
JustArchi
a9d3f0e1e6 Rewrite entire ASF HTTP stack
Previous implementation was quite naive and assumed a lot of non-guaranteed premises. Checking if our session is valid before doing each request is very stupid, but it was needed for multi-user sessions. Next, even if we checked that our session is valid (or revalidated it if needed), we then assumed it's valid for at least X seconds, which is once again entirely false. Moreover, on top of those two issues, refreshing our session could do absolutely nothing as there is no guarantee that once-refreshes session stays like that even for our very next request.

Get rid of all of this shit and rewrite it with proper mechanism. We're making a request, if that request results in redirection to session refresh, refresh session, then repeat the same request again. Add failsafes for infinite loops, make it enough thread-safe and optimized for concurrent usage.

This commit won't only improve previously half-valid implementation, but will also greatly optimize number of requests being sent, as we won't need to check our session before each request. The entire thing should work like that since beginning.
2018-02-16 15:49:18 +01:00
JustArchi
8b1a3044ea Expose AvatarHash, #733 2018-02-01 00:46:18 +01:00
JustArchi
e7f517aecf Follow-up code cleanup after #727 2018-01-08 01:48:57 +01:00
JustArchi
6bbff6ab4e Happy new year 2018-01-01 02:56:53 +01:00
JustArchi
319fe69088 Don't keep SteamTimeDifference infinitely
With long-running systems time might run out of sync eventually.
2017-12-17 11:31:42 +01:00
JustArchi
339eb8df0d Rename 2/2 2017-12-14 08:23:17 +01:00
JustArchi
6a74084729 Internal improvements regarding https://github.com/SteamRE/SteamKit/issues/491
It also fixes V3.0.4.6 regression reported in http://steamcommunity.com/groups/ascfarm/discussions/1/1488866180608154465 - even though it's just a workaround for Steam Network issue.
2017-11-26 19:08:48 +01:00
JustArchi
d5f44f8f6c ReSharper: update header 2017-11-18 17:27:06 +01:00
JustArchi
2d767c41aa Fix latest Steam notifications fuckup
Initially the issue was observed in #697, but that itself wasn't exactly what was fixed here, as multiple evaluation of the same trade is still wanted scenario.

The real issue was reported in http://steamcommunity.com/groups/ascfarm/discussions/1/2425614539578192287/

In a huge TL;DR, Steam is now sending trades notification each time something fetches current trade offers, be it ASF, the user, or some other script.

This will lead to possible ASF trade loop, as we'll get wanted notification about new trades, fetch them, leave some trades untouched, get new notification about trades and so on.

Initially I wanted to fix this in dirty way by just ignoring any extra notifications that happened since API call until 5 extra seconds after we were done with entire parsing, but I found much better solution - Steam actually includes extra info about amount of trades/items in notification (makes sense, since Steam client displays that info too). We can make use of that info and simply ignore any extra notification that results in same or smaller count.

Thanks to that we didn't only add a decent workaround for this recent Steam fuckup, but we also improved internal ASF code that will no longer schedule extra parsing if we accepted/rejected only some of the trades, making me happy with the actual solution.
2017-11-18 17:20:24 +01:00
JustArchi
acae0d8d0e Improve shutdown looting
As discussed in http://steamcommunity.com/groups/ascfarm/discussions/1/1483232961032339275/ - it's possible that SendOnFarmingFinished + ShutdownOnFarmingFinished bot will shutdown before master receives the trade and accepts it through default trading preferences.

This can be easily solved by caching SteamID and using it instead. While I'm at it, let's rewrite other parts that made use of SteamID as well.
2017-10-13 09:05:08 +02:00
JustArchi
035b70458e Rewrite ASF inventory fetching into new endpoint, #646 2017-09-17 18:01:17 +02:00
JustArchi
6aa5a633e4 async/dispose code review 2017-08-04 19:26:37 +02:00
JustArchi
f24be67c8c Bunch of stuff for #605 2017-08-01 12:41:57 +02:00
JustArchi
93716218a5 Misc 2017-07-13 06:08:52 +02:00
JustArchi
6d22b19ef3 Announce MatchableTypes 2017-07-10 23:04:33 +02:00
JustArchi
0ecf6da44e Initial .NET Core 2.0 port 2017-06-26 03:36:51 +02:00
JustArchi
c81fd05755 Include TradeToken in STM announcement 2017-06-18 01:27:45 +02:00
JustArchi
8c0a100ae8 Enhance InventoryLimiterDelay
Gifts/Login limiter is actually working decent, because response is nearly instant and fast enough to not worry about it in long-run.
With inventory things are entirely different, as inventory fetching might take even a very long time, and while fetching one inventory, we might already run out of our delay and start fetching another one.
This is not a big functionality-wise, as it's nothing new for ASF to parse multiple inventories concurrently, but Steam Community actually counts number of requests, and our inventory function might ask for multiple pages during execution, which could quickly lead to a situation of 10+ ongoing inventory requests being sent concurrently for too many accounts at once, as we can't predict not only how long the request will be handled, but also how many sub-requests we will do across one.
This means that for optimal performance in terms of rate-limiting, we must limit ASF to one inventory request at a time, with mandatory InventoryLimiterDelay before asking for another one.
This can degrade performance of previously fast !loot requests on multiple accounts at once (especially with bigger inventories), but it will also decrease significantly a chance of getting rate-limited and requests failing.
2017-04-08 04:47:38 +02:00
JustArchi
fcf9686a79 Revert "Resharper cleanup"
This reverts commit 7c8d7b5ada.

Bad cleanup.
2017-04-05 17:01:18 +02:00
JustArchi
7c8d7b5ada Resharper cleanup 2017-04-05 16:59:48 +02:00
Logerfo
e4da0c05d5 Merge branch 'master' into master 2017-04-05 10:33:13 -03:00
JustArchi
4fc3787cc0 Don't announce if we have less than 100 cards in inventory 2017-03-30 01:26:15 +02:00
JustArchi
07b84d8452 Increase statistics defaults 2017-03-20 17:21:56 +01:00
JustArchi
734305263d Further statistics-related improvements 2017-03-19 21:56:36 +01:00
Bruno Logerfo
f8b2fcda7a C# 7.0 syntax sugars 2017-03-14 08:20:29 -03:00
JustArchi
d7f2610313 Bump MinHeartBeatTTL from 5 to 10 2017-02-08 14:55:40 +01:00
JustArchi
1363b23008 Handle temporary fetching failures appropriately 2017-02-08 14:41:28 +01:00
JustArchi
89a36beeae Improve statistics reporting
Skip reporting when user has private or empty inventory
2017-02-08 14:35:01 +01:00
JustArchi
fc4574d143 Closes #445
Review https://github.com/JustArchi/ArchiSteamFarm/wiki/Logging for examples once I'm done updating the wiki
2017-01-31 01:10:01 +01:00
JustArchi
e338ae4188 DateTime optimizations
DateTime.UtcNow is from at least 30 up to even 117 times faster than DateTime.Now. We have many places in which we compare our date to previous one we set ourselves - in all those places we can (and should) use UtcNow instead of Now.
Local DateTime is still around in some places, those that are user-specific, such as when logging messages.
2017-01-23 00:46:44 +01:00
JustArchi
de897aaa92 Rewrite #414 in a way that makes me happy 2017-01-11 15:22:00 +01:00
JustArchi
ba8d70aebb Copyright update 2017-01-02 20:05:21 +01:00
JustArchi
30c69cf57c Move main ArchiLogger from ASF to Program
It makes more sense to put it in ASF class due to sharing potential, but I want to unify ArchiBoT logging and this makes it easier for maintenance
2016-12-23 18:49:52 +01:00
JustArchi
f1e67ee333 Make older Mono being able to access Statistics server 2016-12-19 04:45:30 +01:00
JustArchi
7fe65144c1 Code cleanup 2016-12-18 16:03:32 +01:00
JustArchi
b7eac82596 Misc 2016-12-17 03:28:39 +01:00
JustArchi
51ce849aee Misc 2016-12-17 02:28:28 +01:00
JustArchi
78af201cdb Skip reporting non-STM accounts
Initially I wanted to use this to build reliable statistics as in, number of active/inactive accounts, total accounts and so on
However, I don't really think my server will be able to handle it with more and more users, even if reporting that was active so far was still bare minimum.
Let's just stick to STM-only reporting for now, I don't have enough money for anything more advanced for now.
2016-12-17 02:27:14 +01:00
JustArchi
0af6d48a3c Revert "Misc"
This reverts commit bbe38e34ee.
2016-12-07 14:27:59 +01:00
JustArchi
bbe38e34ee Misc 2016-12-07 14:20:58 +01:00
JustArchi
e937579c46 Add unique ASF ID 2016-12-07 14:05:19 +01:00
JustArchi
1a917a668c Misc 2016-12-04 20:41:01 +01:00
JustArchi
065d29177a Misc 2016-12-04 15:31:04 +01:00
JustArchi
b5cc74ca42 Misc 2016-12-04 15:30:00 +01:00
JustArchi
d48e0b06b6 Don't emit heartbeats when not required
This way people won't kill my server with DDoS...
2016-12-04 08:20:18 +01:00