home-assistant / iOS

:iphone: Home Assistant for Apple platforms
https://companion.home-assistant.io
Other
1.58k stars 310 forks source link

iOS app document & data storage size will grow very large over time when not relaunched. #2275

Open jaymunro opened 1 year ago

jaymunro commented 1 year ago

iOS device model, version and app version

Model Name: iPad (various) Software Version: iOS 12.5.6 App version: 2022.10.1

Home Assistant Core Version 2022.12.8

Describe the bug This is as per #2207 which was closed after #2231 was implemented.

However this is still an issue with “kiosk” like devices that just have the app running 24/7 and never re-launch.

Can a periodic compaction, say every 24 hours or so, be kicked off to resolve this?

To Reproduce Leave the iOS app running in the foreground for a week or so.

Expected behavior Realm database does not grow to gigabytes in size and consume all available disk space.

Screenshots

Additional context Re-launching the app does indeed compact the db, but this should not be an ongoing requirement for families that have an iPad mounted on the wall dedicated to home control.

jaymunro commented 1 year ago

An update. It seems that around 10% of a 16GB iPad is being consumed every 24 hours. This shows that a compaction at least every 24 hours is needed, if not more often.

B27B59FD-5046-404B-AD97-DE266F6459F1

jaymunro commented 1 year ago

Attached here is an image showing current build with 6.7 GB being consumed. IMG_0002

zacwest commented 1 year ago

Realm 10.35.0 gained the ability to live compact, which should help this. https://github.com/realm/realm-swift/releases/tag/v10.35.0

jaymunro commented 1 year ago

Great. Does this need to be bumped to be included in an update of the iOS app for HA?

zacwest commented 1 year ago

Yep, this will require an app release and upgrading the dependency

zacwest commented 1 year ago

Please try the latest TestFlight build and see if it resolves the issue for you.

jaymunro commented 1 year ago

Installed for testing now. Will keep this thread updated.

jaymunro commented 1 year ago

The TestFlight beta app seems to have made no difference. 169B6FD9-BB4F-4978-828F-F50C9EDD1BFF

jaymunro commented 1 year ago

Since installing the test flight beta on Feb 19, the app doesn’t even compact after restarts. Have even tried force quitting the app (flick up in running app list) but no compacting.

8FC652E1-0C4A-4097-B1F0-C9B027CCFBDE