-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose sync session shutdown and realm delete files in one API #5646
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @fealebenpae was against exposing this in the C API, but it was requested by @cmelchior. I believe this is what it is needed in order to expose this functionality in the C API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against having this functionality in the C API, or at all, I think it can solve a lot of problems, but the current implementation is broken - SyncSession::shutdown_and_wait()
will block until all sync sessions are terminated, or the sync client is stopped explicitly. For apps with more than one realm open at a time this means that the call will block until all other realms are closed and their sessions terminate, and that's not what our users would expect out of this API.
OK, I see what you mean. I don't see an easy solution, though. You can either block until all the sessions are closed or signal that all the sessions must close without waiting, but in this case deleting the files won't succeed ... |
We could investigate fixing the |
Adding @danieltabacaru in order to understand how complex would it be to fix this API before to expose it in the C API |
What will this fix do? This is not clear to me. You don't want the client to block until all the sessions are closed? Doing this will for sure make |
@nicola-cab @fealebenpae I looked at the code in The sync client team has plans to refactor the code around SyncManager/SyncSession/SyncUser/etc and we could fix this then, so I guess the question is how urgent is this needed? Bottom line, I don't see how this fix improves on using If we decide to go with this fix though, since we wait to close all sessions we should also delete all realms. So do something like |
I would say we need this to allow SDKs to unlink successfully realm files on Windows. All the SDKs that run on Windows have this problem of needing to manage a file handle that is still kept alive (also some object store test does have this issue and I had to disable it). This can also be needed in case of failures during realm initialization. Most of the time, the SDKs will need to close and delete all the realm files. My preference here would be to expose a C API (or in general an API) that will close all the sync sessions (releasing the handle) and delete the realm files explicitly, to be called by the SDK in case this is needed. I will make this PR a 'draft' and wait for |
What, How & Why?
Expose new C API for closing realm sync session and deleting files.
Fixes: #5542
☑️ ToDos