-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: introduce new
eventHistoryTTL
and minBidCacheTTL
settings t…
…o control memory usage (#10308) * Core: introduce `eventHistoryTTL` to periodically purge events from event log * Core: introduce `preserveBidCache` to drop stale auctions * `minBidCacheTTL` instead of `preserveBidCache`
- Loading branch information
Showing
12 changed files
with
705 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {config} from './config.js'; | ||
import {logError} from './utils.js'; | ||
let TTL_BUFFER = 1; | ||
|
||
const listeners = []; | ||
|
||
config.getConfig('ttlBuffer', (cfg) => { | ||
if (typeof cfg.ttlBuffer === 'number') { | ||
const prev = TTL_BUFFER; | ||
TTL_BUFFER = cfg.ttlBuffer; | ||
if (prev !== TTL_BUFFER) { | ||
listeners.forEach(l => l(TTL_BUFFER)) | ||
} | ||
} else { | ||
logError('Invalid value for ttlBuffer', cfg.ttlBuffer); | ||
} | ||
}) | ||
|
||
export function getTTL(bid) { | ||
return bid.ttl - (bid.hasOwnProperty('ttlBuffer') ? bid.ttlBuffer : TTL_BUFFER); | ||
} | ||
|
||
export function onTTLBufferChange(listener) { | ||
listeners.push(listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.