Skip to content

Commit

Permalink
Schedule semaphore release in background
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Feb 5, 2016
1 parent f86bc32 commit 6a172ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ArchiSteamFarm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ internal static void Restart() {

internal static async Task LimitSteamRequestsAsync() {
await SteamSemaphore.WaitAsync().ConfigureAwait(false);
await Utilities.SleepAsync(5 * 1000).ConfigureAwait(false); // We must add some delay to not get caught by Steam rate limiter
SteamSemaphore.Release();
var releaseLater = Task.Run(async () => {
await Utilities.SleepAsync(5000).ConfigureAwait(false); // We must add some delay to not get caught by Steam rate limiter
SteamSemaphore.Release();
});
}

internal static string GetUserInput(string botLogin, EUserInputType userInputType, string extraInformation = null) {
Expand Down
6 changes: 4 additions & 2 deletions ArchiSteamFarm/Trading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ internal sealed class Trading {

internal static async Task LimitInventoryRequestsAsync() {
await InventorySemaphore.WaitAsync().ConfigureAwait(false);
await Utilities.SleepAsync(3000).ConfigureAwait(false); // We must add some delay to not get caught by Steam rate limiter
InventorySemaphore.Release();
var releaseLater = Task.Run(async () => {
await Utilities.SleepAsync(3000).ConfigureAwait(false); // We must add some delay to not get caught by Steam rate limiter
InventorySemaphore.Release();
});
}

internal Trading(Bot bot) {
Expand Down

0 comments on commit 6a172ce

Please sign in to comment.