Commit Graph

24 Commits

Author SHA1 Message Date
JustArchi
a57dc7387c Fix FarmingOrder + add ordering by redeem datetimes
Since we already have logic for that, such farming order is cool too.
2017-07-23 11:55:44 +02:00
JustArchi
7bb3b38ea4 Closes #522 2017-07-23 10:27:20 +02:00
JustArchi
0ecf6da44e Initial .NET Core 2.0 port 2017-06-26 03:36:51 +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
JustArchi
4f5d46b422 Closes #515 2017-03-28 21:27:01 +02:00
JustArchi
a8045ac50b Fix async/await with ConcurrentHashSet
Now this is a nice bug that was found accidentally by ArchiBoT...
ReaderWriterLockSlim() is very decent solution, but it's thread-based, and we're using our ConcurrentHashSet in mixed async/sync context. This means that if we use something like:
foreach (var item in concHashSet) {
    await AnythingAsync().ConfigureAwait(false);
}
It's totally possible that we'll request read lock as thread 1, and release the read lock as thread 2, which will lead to RWLock exception => System.Threading.SynchronizationLockException: The read lock is being released without being held.
Fortunately it looks like we didn't have any scenario like this in ASF, as this was possible only when we async/await while enumerating over ConcurrentHashSet, so that specific bug didn't affect ASF codebase (yet). Still, I must fix this as current implementation is not thread-safe, so our HashSet is in fact not concurrent in the first place.
I analyzed possible solutions and there are basically 3: either using ConcurrentDictionary and wrapping around it, replacing lock with SemaphoreSlim, or using third-party AsyncReaderWriterLock from StephenCleary. SemaphoreSlim entirely kills the concept of multiple readers one writer, and could affect performance negatively, moreover - it doesn't support upgreadable lock scenario we have with ReplaceIfNeededWith(). Concurrent dictionary would be nice if I didn't have that awful memory hit from storing mandatory pointless value, plus I don't really like concept of wrapping around conc dictionary if I can simply use it right away and drop my conc hashset entirely. AsyncReaderWriterLock seem to be really well written, and works on Mono + should be compatible with .NET core in the future, so we should go for it as it's the best bet both performance-wise and memory-wise.
This brings another package dependency and changes a bit backend of ConcurrentHashSet
2017-02-07 20:14:51 +01:00
JustArchi
a5c1b0c253 Unify ASF newline responses 2017-01-31 22:03:20 +01:00
JustArchi
f3b53d3da2 Implement ArchiBoT way of skipping unreleased games for farming purpose, closes #425 2017-01-17 17:59:40 +01:00
JustArchi
ba8d70aebb Copyright update 2017-01-02 20:05:21 +01:00
JustArchi
fb87ed8abc Misc 2016-11-29 13:08:59 +01:00
JustArchi
bcddffc2f2 Misc code enhancement 2016-11-29 12:16:32 +01:00
JustArchi
df218074ad Gigantic code cleanup
Time to enforce some common file layout, as general mess started to annoying me. Sorry in advance for people using custom forks and having merge conflicts, this will help everybody in long-run
2016-11-24 07:32:16 +01:00
JustArchi
2816ecaa90 Further optimize InMemoryServerListProvider and make it thread-safe 2016-08-19 04:57:21 +02:00
JustArchi
d517562467 Add more farming orders 2016-07-30 20:55:43 +02:00
JustArchi
c33f575c40 Implement AddRange() + refactoring 2016-07-29 23:36:57 +02:00
JustArchi
a90573e0ea Implement smart algorithm of avoiding OnCooldown
I really like this approach, as it has only one caveat: memory usage.
We need to keep in memory list of all packages that our account owns, which will result of N * 32bit extra memory usage, where N is equal to number of package licenses the account owns. This results in around 16 KB extra memory usage for my 4k account.
However, apart from that there are no real caveats as checking if we own given packageID is O(1) operation, and I think that apart from this extra memory footprint there can be more benefits of having this field in future, besides, my 16 KB is extreme case, as usually nobody goes that high. Ship it!
2016-07-28 21:20:57 +02:00
JustArchi
4f01dc39fc Code review 2016-07-25 06:08:45 +02:00
JustArchi
feb3fbfe59 Get used to null propagation 2016-07-10 20:17:35 +02:00
JustArchi
2cf2df62c5 This is no longer required 2016-06-27 21:17:23 +02:00
JustArchi
93191f9066 Add logic for MaxGamesPlayedConcurrently
This is a limit introduced by Steam Network, limit for Steam Client is 30, but we don't have to respect that one
2016-06-27 21:09:58 +02:00
JustArchi
99dbca1b36 Code review 2016-06-25 03:56:49 +02:00
JustArchi
b60b864aca Misc 2016-05-13 19:43:48 +02:00
JustArchi
4b50596709 Enhance concurrent access with ArchiBoT concurrent hashset 2016-05-13 19:39:54 +02:00