RUM-6093:Add TimeBank in session replay recorder for dynamic optimisation#2247
Conversation
| if (timePassedSinceLastExecution >= maxRecordDelayInNs) { | ||
| executeRunnable(runnable) | ||
| } else { | ||
| handler.postDelayed({ executeRunnable(runnable) }, DEBOUNCE_TIME_IN_MS) |
There was a problem hiding this comment.
Warning
Shouldn't you remove previously posted runnables, if there are multiple debounced executions ?
There was a problem hiding this comment.
You are right, so I changed the place where runInTimeBalance should wrap up.
Now runInTimeBalance wrap only the function of executeRunnable, so we check first the condition of debounce frequency, then check if it meets the time balance.
| if (timePassedSinceLastExecution >= maxRecordDelayInNs) { | ||
| executeRunnable(runnable) | ||
| } else { | ||
| handler.postDelayed({ executeRunnable(runnable) }, DEBOUNCE_TIME_IN_MS) |
ff54810 to
fe0410a
Compare
8d854e7 to
705fa22
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/sr-dynamic-optimisation #2247 +/- ##
===================================================================
- Coverage 70.12% 69.99% -0.13%
===================================================================
Files 727 728 +1
Lines 27062 27077 +15
Branches 4560 4561 +1
===================================================================
- Hits 18975 18951 -24
- Misses 6827 6842 +15
- Partials 1260 1284 +24
|
| fun `M allow everything W set max balance to 1000ms per sec`(forge: Forge) { | ||
| recordingTimeBank = RecordingTimeBank(1000) |
There was a problem hiding this comment.
what if it is more than 1s? shouldn't we cover this as well?
There was a problem hiding this comment.
Indeed, I updated the test to M allow everything W set max balance more than 1000ms per sec with a random value with 1000ms as min value.
86dac33
705fa22 to
86dac33
Compare
What does this PR do?
Add TimeBank in session replay recorder for dynamic optimisation.
The main idea is to have a time balance in this
TimeBank, every execution of session replay recording will consume this balance, and the balance will be recharged during the time passing until a maximum balance is reached.Before every execution of recording, if the balance is negative, the execution will skipped until the balance is recharged to positive.
Motivation
RUM-6093
Review checklist (to be filled by reviewers)