chat: add disposal spec - #352
Conversation
7d50ef7 to
d824031
Compare
| h2(#roos-disposal). Rooms Disposal | ||
|
|
||
| Rooms in the Chat SDK are a complex type that register many different listeners and consume many different events. Therefore, there must be methods available to clean up any listeners to allow for garbage collection. | ||
|
|
||
| ** @(CHA-RD1)@ @[Testable]@ The @Rooms@ map / manager must offer an internal @dispose@ method that must prepare the rooms manager for garbage collection and release all managed rooms. | ||
| *** @(CHA-RD1a)@ @[Testable]@ When @dispose@ is called, it must mark the instance as disposed to prevent future room operations. | ||
| *** @(CHA-RD1b)@ @[Testable]@ If no rooms exist when @dispose@ is called, the method must complete successfully without error. | ||
| *** @(CHA-RD1c)@ @[Testable]@ If rooms exist in the map, the @dispose@ method must release all rooms currently in the rooms map concurrently. | ||
| *** @(CHA-RD1d)@ @[Testable]@ The @dispose@ method must wait for all room release operations to complete before resolving. | ||
|
|
There was a problem hiding this comment.
I thought the point of the spec generally is public API. These points describe how things work internally. Do we want these in the spec?
There was a problem hiding this comment.
Whilst we've tried to focus it on the public API where possible, there are occasions with complex internal behaviour that needs specifying to avoid implementation divergence (e.g. RTL3d specifies performing an internal attach operation where necessary). We did the same with the room lifecycle manager.
By having a spec point for the internal GC methods, we're ensuring appropriate behaviour in response to the public API
There was a problem hiding this comment.
What I have done though is 32dcbe3 which makes it a bit less prescribe-y on the API, to make it clear that it's an internal impl mechanism.
vladvelici
left a comment
There was a problem hiding this comment.
There's quite a bit of internal API in this. Shouldn't the spec mostly focus on the public API and behaviour we expect from the SDK when interacting with this public API?
Adds a specification for disposing of the Chat Client and its rooms instance.
CHA-1054