Skip to content

Conversation

@greenrobot
Copy link
Member

No description provided.

@greenrobot greenrobot changed the base branch from main to dev January 7, 2026 16:31
@greenrobot greenrobot changed the base branch from dev to main January 7, 2026 16:31
@greenrobot
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37bee34205

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +560 to +564
c.obx_sync_listener_error(self.__c_sync_client_ptr, None, None)
c.obx_sync_listener_login(self.__c_sync_client_ptr, None, None)
c.obx_sync_listener_login_failure(self.__c_sync_client_ptr, None, None)
c.obx_sync_listener_connect(self.__c_sync_client_ptr, None, None)
c.obx_sync_listener_disconnect(self.__c_sync_client_ptr, None, None)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make SyncClient.close idempotent before C calls

In close(), the C cleanup functions are called unconditionally with self.__c_sync_client_ptr. Because a store-close listener is registered and users can also call SyncClient.close() manually, it’s easy to hit a second close (e.g., client.close() then store.close()), which will pass a NULL handle into the C API. That contradicts the docstring (“Does nothing if this sync client has already been closed”) and can lead to C-level errors or crashes if the native API does not accept NULL. Add a guard (if self.__c_sync_client_ptr is None: return) before invoking the C functions to make close truly idempotent.

Useful? React with 👍 / 👎.

Comment on lines +856 to +860
if store in Sync.__sync_clients:
raise ValueError('Only one sync client can be active for a store')
client = SyncClient(store, server_urls, filter_variables)
client.set_multiple_credentials(credentials_list)
Sync.__sync_clients[store] = client

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove closed clients from Sync.__sync_clients

client_multi_creds_multi_urls() stores the new client in Sync.__sync_clients and rejects future creations for the same store, but nothing ever removes that entry on SyncClient.close() or store close. As a result, once a client is closed, calling this factory again with the same store will always raise ValueError even though no client is active. This prevents restarting sync for a store without restarting the process; consider removing the store from the registry when the client closes.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants