Implement utility method that ensures semaphore is in healthy state.
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
native/ios/Comm/TemporalMessageStorage/TemporalMessageStorage.mm | ||
---|---|---|
142–155 | Maybe we should enhance this method by trying to acquire and immediately release the lock? If that succeeds, the lock is fine. |
native/ios/Comm/TemporalMessageStorage/TemporalMessageStorage.mm | ||
---|---|---|
142 | If a method starts with ensure, the expectation is that it checks the state and fix it if it was invalid. In this case, we only check the state and not fix it, so instead we should use e.g. check |
native/ios/Comm/TemporalMessageStorage/TemporalMessageStorage.mm | ||
---|---|---|
142 | If semaphore gets broken and number of random files grows large this method will remove it so that next call that tries to acquire semaphore will create new one that will work fine so in my opinion it fixes the state if it is not valid. | |
142–155 | The only case in which storageContents.count > randomFilesNumberThreshold is true and semaphore is fine is that NotificationService attempted to write many messages (20) exactly when AppDelegate was reading which is quite unlikely. We can be almost certain that if number of random files grows large the semaphore is broken. Making an additional check by trying to acquire it will introduce additional possibility for the semaphore to be left broken (if NotificationService gets killed before it releases the lock). |