internal async Task CheckTrades() {
// We aim to have a maximum of 2 tasks, one already parsing, and one waiting in the queue
// This way we can call this function as many times as needed e.g. because of Steam events
lock (TradesSemaphore) {
if (ParsingScheduled) {
return;
}
ParsingScheduled = true;
}
await TradesSemaphore.WaitAsync().ConfigureAwait(false);
try {
lock (TradesSemaphore) {
ParsingScheduled = false;
}
await ParseActiveTrades().ConfigureAwait(false);
} finally {
TradesSemaphore.Release();
}
}