Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Sharedb connection rework#107

Merged
kpal81xd merged 8 commits intomainfrom
sharedb-fix
Oct 23, 2025
Merged

Sharedb connection rework#107
kpal81xd merged 8 commits intomainfrom
sharedb-fix

Conversation

@kpal81xd
Copy link
Contributor

Fixes

  • Folded private methods into callbacks directly
  • Uses a promise lock instead of a queue for queued messages

@kpal81xd kpal81xd self-assigned this Oct 23, 2025
@slimbuck slimbuck requested a review from Copilot October 23, 2025 16:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the ShareDB connection implementation by eliminating private methods in favor of inline callbacks and replacing the message queue with a promise-based locking mechanism. The changes consolidate ShareDB type registration from a separate module into the connection file and introduce a new Deferred utility class.

Key Changes:

  • Replaced message queue (_sendQueue) with promise-based locking (_sendPromise) using a new Deferred class
  • Inlined private event handler methods (_onConnect, _onError, etc.) directly into event listener callbacks
  • Moved ShareDB type registration from sharedb.ts into connection.ts

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/sharedb.ts Removed standalone ShareDB configuration module
src/realtime/connection.ts Refactored connection handling with inline callbacks and promise-based message sending
src/deferred.ts Added new utility class for creating deferred promises

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kpal81xd kpal81xd merged commit e59671b into main Oct 23, 2025
3 checks passed
@kpal81xd kpal81xd deleted the sharedb-fix branch October 23, 2025 18:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments