-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Darwin] MTRDevice should throttle writes to the attribute storage #33535
[Darwin] MTRDevice should throttle writes to the attribute storage #33535
Conversation
PR #33535: Size comparison from 70dc5a8 to 8c0085a Decreases (1 build for efr32)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
PR #33535: Size comparison from eb515e1 to 2725771 Decreases (1 build for efr32)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
2725771
to
1e461a5
Compare
1e461a5
to
4f7333e
Compare
PR #33535: Size comparison from c3ef110 to 4f7333e Decreases (1 build for efr32)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
PR #33535: Size comparison from c3ef110 to 285b2b1 Increases above 0.2%:
Increases (13 builds for cyw30739)
Decreases (9 builds for cyw30739, efr32)
Full report (52 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32)
|
PR #33535: Size comparison from c3ef110 to 59bf484 Increases above 0.2%:
Increases (13 builds for cyw30739)
Decreases (9 builds for cyw30739, efr32)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
PR #33535: Size comparison from c3ef110 to 9ad4922 Increases above 0.2%:
Increases (14 builds for cyw30739, efr32)
Decreases (9 builds for cyw30739, efr32)
Full report (52 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32)
|
PR #33535: Size comparison from c3ef110 to 9a4f3e4 Increases above 0.2%:
Increases (14 builds for cyw30739, efr32)
Decreases (10 builds for cyw30739, efr32, linux)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
PR #33535: Size comparison from c3ef110 to d9633ee Increases above 0.2%:
Increases (14 builds for cyw30739, efr32)
Decreases (10 builds for cyw30739, efr32, linux)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
…n the machine is slow
… fails the test when the machine is slow
29ba757
to
d8f14fa
Compare
PR #33535: Size comparison from 57f29a8 to d8f14fa Decreases (1 build for efr32)
Full report (83 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
@@ -423,11 +441,27 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle | |||
} | |||
_clusterDataToPersist = nil; | |||
_persistedClusters = [NSMutableSet set]; | |||
|
|||
// If there is a data store, make sure we have an observer to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"to" what?
_deviceReportingExcessivelyStartTime = nil; | ||
_reportToPersistenceDelayCurrentMultiplier = 1; | ||
|
||
if (_persistedClusters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an odd check. Why is this not just unconditional (and then no-op if there is nothing to persist right now)? Needs comments, at least.
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* Class that configures how MTRDevice objects persist its attributes to storage, so as to not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"their" not "its", since it's "objects"?
* When the running average time between reports dips below timeBetweenReportsTooShortMinThreshold | ||
* for the first time, the time will be noted. If the device remains in this state for longer than | ||
* deviceReportingExcessivelyIntervalThreshold, persistence will stop until the average time between | ||
* reports go back above timeBetweenReportsTooShortMinThreshold. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"goes back".
In terms of the implementation, if the device is reporting excessively for a bit, and then stops reporting entirely for a long time, shouldn't we persist at some point? Right now, I don't think we do....
Seems to me like we should compute when the average time would go back above if we got no reports until then and schedule something to persist at that point or something.
* be used to replace all of them: | ||
* | ||
* reportToPersistenceDelayTimeDefault (15) | ||
* reportToPersistenceDelayTimeMaxDefault (20 * kReportToPersistenceDelayTimeDefault) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kReportToPersistenceDelayTimeDefault is not a concept in this API... Should just say 20 * 15
, I think.
This change makes MTRDevice throttle writing to the attribute storage. It has three parts:
Currently working on unit tests, and fixing the unit tests that this broke.