[WIP] Guard against creating multiple DatabaseContainer instances sharing the DB file
๐ Issue Links
Hopefully resolves: PBE-5686
๐ฏ Goal
Do not let multiple DatabaseContainers to modify the DB.
๐ Summary
- Clear changes in the writableContext when save fails
- Guard against creating multiple DatabaseContainers which use the common file
- Remove the canWriteData check because it does not help (serial queue)
๐ Implementation
ChatClient is meant to be a single instance during the app's life-time. If there are multiple instances, the DB state is going to be inconsistent. Therefore, we should guard against this.
๐งช Manual Testing Notes
N/A
โ๏ธ Contributor Checklist
- [x] I have signed the Stream CLA (required)
- [x] This change should be manually QAed
- [x] Changelog is updated with client-facing changes
- [ ] Changelog is updated with new localization keys
- [x] New code is covered by unit tests
- [ ] Comparison screenshots added for visual changes
- [ ] Affected documentation updated (docusaurus, tutorial, CMS)
SDK Size
title |
develop |
branch |
diff |
status |
|---|---|---|---|---|
| StreamChat | 6.76 MB | 6.76 MB | 0 KB | ๐ข |
| StreamChatUI | 4.41 MB | 4.41 MB | 0 KB | ๐ข |
SDK Performance
target |
metric |
benchmark |
branch |
performance |
status |
|---|---|---|---|---|---|
| MessageList | Hitches total duration | 10 ms | 5.01 ms | 49.9% ๐ผ | ๐ข |
| Duration | 2.6 s | 2.54 s | 2.31% ๐ผ | ๐ข | |
| Hitch time ratio | 4 ms per s | 1.98 ms per s | 50.5% ๐ผ | ๐ข | |
| Frame rate | 75 fps | 78.04 fps | 4.05% ๐ผ | ๐ข | |
| Number of hitches | 1 | 0.4 | 60.0% ๐ผ | ๐ข | |
| ChannelList | Hitches total duration | 12.5 ms | 17.52 ms | -40.16% ๐ฝ | ๐ด |
| Duration | 2.6 s | 2.54 s | 2.31% ๐ผ | ๐ข | |
| Hitch time ratio | 5 ms per s | 6.89 ms per s | -37.8% ๐ฝ | ๐ด | |
| Frame rate | 72 fps | 74.31 fps | 3.21% ๐ผ | ๐ข | |
| Number of hitches | 1.2 | 1.8 | -50.0% ๐ฝ | ๐ด |
SDK Size
title |
develop |
branch |
diff |
status |
|---|---|---|---|---|
| StreamChat | 6.82 MB | 6.83 MB | +17 KB | ๐ข |
| StreamChatUI | 4.42 MB | 4.42 MB | 0 KB | ๐ข |
I guess we can merge this one - but it's just based on assumptions, right? Btw, some tests are still failing.
Unfortunately can't reproduce the actual crash. This PR aims to make it more clear how multiple ChatClient instances can be used.
Quality Gate passed
Issues
159 New issues
0 Accepted issues
Measures
0 Security Hotspots
83.6% Coverage on New Code
0.1% Duplication on New Code