Skip to content

Commit 672decf

Browse files
committed
decided to use backoff system, lower the default limit
1 parent 593a341 commit 672decf

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

src/game/client/tf/tf_gc_client.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,19 @@ void CTFGCClientSystem::InvalidatePingData()
308308
// Backoff api
309309
void CTFGCClientSystem::WebapiInventoryState_t::Backoff()
310310
{
311+
if (m_nBackoffSec == 0)
311312
#ifdef BDSBASE
312-
RequestSucceeded();
313+
m_nBackoffSec = GC_BACKOFF_RATELIMIT_TIME;
313314
#else
314-
if ( m_nBackoffSec == 0 )
315315
m_nBackoffSec = 20;
316+
#endif
316317
else
317318
m_nBackoffSec = (m_nBackoffSec * 12 + 9) / 10; // exponential backoff @ 1.2x factor, round up
318319

319320
m_rtNextRequest = CRTime::RTime32TimeCur() + m_nBackoffSec;
321+
322+
#ifdef BDSBASE
323+
DevMsg("[GC CLIENT] Backing off for an additional %i seconds.\n", m_nBackoffSec);
320324
#endif
321325
}
322326

@@ -328,11 +332,7 @@ void CTFGCClientSystem::WebapiInventoryState_t::RequestSucceeded()
328332

329333
bool CTFGCClientSystem::WebapiInventoryState_t::IsBackingOff()
330334
{
331-
#ifdef BDSBASE
332-
return false;
333-
#else
334335
return m_rtNextRequest != 0 && CRTime::RTime32TimeCur() <= m_rtNextRequest;
335-
#endif
336336
}
337337

338338
void CTFGCClientSystem::WebapiInventoryThink()

src/game/server/tf/tf_gc_server.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4029,15 +4029,19 @@ ConVar tf_mm_trusted( "tf_mm_trusted", "0", FCVAR_NOTIFY | FCVAR_HIDDEN,
40294029
// Backoff api
40304030
void CTFGCServerSystem::WebapiEquipmentState_t::Backoff()
40314031
{
4032+
if ( m_nBackoffSec == 0 )
40324033
#ifdef BDSBASE
4033-
RequestSucceeded();
4034+
m_nBackoffSec = GC_BACKOFF_RATELIMIT_TIME;
40344035
#else
4035-
if ( m_nBackoffSec == 0 )
40364036
m_nBackoffSec = 20;
4037+
#endif
40374038
else
40384039
m_nBackoffSec = ( m_nBackoffSec * 12 + 9 ) / 10; // exponential backoff @ 1.2x factor, round up
40394040

40404041
m_rtNextRequest = CRTime::RTime32TimeCur() + m_nBackoffSec;
4042+
4043+
#ifdef BDSBASE
4044+
DevMsg("[GC SERVER] Backing off for an additional %i seconds.\n", m_nBackoffSec);
40414045
#endif
40424046
}
40434047

@@ -4049,11 +4053,7 @@ void CTFGCServerSystem::WebapiEquipmentState_t::RequestSucceeded()
40494053

40504054
bool CTFGCServerSystem::WebapiEquipmentState_t::IsBackingOff()
40514055
{
4052-
#ifdef BDSBASE
4053-
return false;
4054-
#else
40554056
return m_rtNextRequest != 0 && CRTime::RTime32TimeCur() <= m_rtNextRequest;
4056-
#endif
40574057
}
40584058

40594059
CTFGCServerSystem::WebapiEquipmentState_t& CTFGCServerSystem::FindOrCreateWebapiEquipmentState( CSteamID steamID )

src/game/shared/tf/tf_gc_shared.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ class IJobReliableMessage; // Defined below
1818

1919
#define MMLog(...) do { ::Msg( __VA_ARGS__ ); } while(false)
2020

21+
#ifdef BDSBASE
22+
// the backoff system is a good idea, but the inventory delay is way too high (20 seconds by default).
23+
// as a result, we have lowered it to 5 seconds.
24+
#define GC_BACKOFF_RATELIMIT_TIME 5
25+
//#define GC_BACKOFF_RATELIMIT_TIME 20
26+
#endif
27+
2128
// Timeout upon successfully sending a reliable message before deciding we should try again. This affects how quickly
2229
// we can detect the Stalled state for a queue in the case of non-responses, as well.
2330
#ifdef CLIENT_DLL

0 commit comments

Comments
 (0)