-
Notifications
You must be signed in to change notification settings - Fork 29
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
Connection only happens on the second click on "Connect" #12
Comments
The first connection to mongo daemon is immediately closed (without an error) right after a successful connection on the first click. The connection to mongo daemon does not close on the second click, thus collections can be retrieved successfully. I'm trying to narrow down the scope why the first connection gets closed. |
@dashersw When we first initiate the database connection, which is obviously from a renderer process, somehow this renderer process gets killed or view gets refreshed and this causes connection to mongo daemon to get closed (checked from As an alternative, I've used I'm not sure if keeping database connection in main process and performing queries via main process causes blocking on UI. Even if keeping the connection in main process is reasonable, mongoose connection cannot be sent back to renderer process due to serialization problem. I've checked accessing store from main process in order to set I'm a bit stuck how to move forward from here on. |
Interesting! We needed to move this to the background process anyway, It shouldn't block the renderer process. We need a good way to manage this IPC events in a scalable manner, because event driven systems tend to get really messy over time. vuex-electron is a package that I use and like. Until we need IPC for other features, we can use vuex-electron and have the connection there and that would solve this issue. |
@dashersw I've tried assigning The only possibility of making this work that I can think of is:
From your message above, I can understand that this is not how you are planning to move forward, at least until the point where IPC will be needed unavoidably. |
Oh sorry — so even though you don’t use anything on the renderer process, just because you set state.connection, even in the main process, it stops working? Do we have to store the connection on the state? Can it be a free running variable? It looks like we won’t be able to avoid IPC at all? Worst case I’d love to have only one IPC call, instead of multiple, if possible. |
@dashersw I've solved the problem. For To clarify my previous attempt to solve this in another way; I was using Imho, database connection should not be a free running variable. I was planning to keep it only in the main process and receive requests for database operations via In any case, the bug was a very small issue but, I've traveled too far away to find it out. |
Sounds great. Can you open a PR with the fix? We can decide about the connection later. |
A connection is established and the collections are fetched only on the second click to the Connect button. It should only take one click.
The text was updated successfully, but these errors were encountered: