Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lwc-events: make refresh frequency configurable #1659

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions atlas-lwc-events/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ atlas.lwc.events {
config-uri = ${atlas.lwc.events.base-uri}"/expressions"
eval-uri = ${atlas.lwc.events.base-uri}"/evaluate"

// Frequency for refreshing configs
config-refresh-frequency = 10s

// Frequency for sending heartbeats
heartbeat-frequency = 2s

// Max buffer size before events will start getting dropped. Used to avoid OOM.
buffer-size = 1000000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class RemoteLwcEventClient(registry: Registry, config: Config)
private val configUri = URI.create(scopedConfig.getString("config-uri"))
private val evalUri = URI.create(scopedConfig.getString("eval-uri"))

private val configRefreshFrequency = scopedConfig.getDuration("config-refresh-frequency")
private val heartbeatFrequency = scopedConfig.getDuration("heartbeat-frequency")

private val bufferSize = scopedConfig.getInt("buffer-size")
private val flushSize = scopedConfig.getInt("flush-size")
private val batchSize = scopedConfig.getInt("batch-size")
Expand All @@ -66,12 +69,12 @@ class RemoteLwcEventClient(registry: Registry, config: Config)
scheduler = new Scheduler(registry, "LwcEventClient", 2)

val refreshOptions = new Scheduler.Options()
.withFrequency(Scheduler.Policy.FIXED_DELAY, Duration.ofSeconds(10))
.withFrequency(Scheduler.Policy.FIXED_DELAY, configRefreshFrequency)
.withStopOnFailure(false)
scheduler.schedule(refreshOptions, () => refreshConfigs())

val heartbeatOptions = new Scheduler.Options()
.withFrequency(Scheduler.Policy.FIXED_DELAY, Duration.ofSeconds(2))
.withFrequency(Scheduler.Policy.FIXED_DELAY, heartbeatFrequency)
.withStopOnFailure(false)
scheduler.schedule(heartbeatOptions, () => sendHeartbeat())

Expand Down
Loading