You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Make all methods of `Conversations` static, and accept a `Client` argument, so that `Conversations` doesn't need to be instantiated anywhere. `Conversations` doesn't really hold state anyway and effectively functions as a wrapper for `Client` right now, so it doesn't make sense for consumers to have to instantiate it and hold onto it.
2. Call `process_outbound_messages()` on init and on message send, so that consumers don't have to manually call it.
3. Limit the connection pool size to 1 for the ephemeral DB instance, because when multiple connections are made, each one operates on a separate database. In the event that a connection is requested from the pool while another one is ongoing, it will wait for a time limit before expiring with an error. An added plus of this is it's much easier for tests to detect deadlocks.
This simplifies the client API quite a bit, as can be seen in `bindings_ffi` and in the `CLI`.
Ideally, we could have spawned a separate thread to call `process_outbound_messages` so that the existing thread is not blocked, but that requires additional refactoring. This requires us to enforce `XmtpApiClient` is `Send + Sync` (which is easy), but also comes up against issues with lifetimes for `Client`, for which a reference is needed in the other thread that may outlive the current thread. This possibly requires us to start using `Arcs` again.
0 commit comments