Skip to content
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

Updated email agent fork #4

Open
wants to merge 93 commits into
base: email-agent-fork
Choose a base branch
from

Conversation

distracteddev
Copy link
Member

Merge email-agent fork with upstream master.

ericyhwang and others added 30 commits March 1, 2022 09:53
The `Connection`'s `createFetchQuery` and `createSubscribeQuery` take an optional existing result array as `options.results`.

It should be an array of Doc instances:
https://github.com/share/sharedb/blob/1cca122c63329665ebfdeceb1984921badb0cf4d/lib/client/connection.js#L563-L567

This PR updates the docs to indicate the specific type, instead of `Object[]`.
📝 Remove `id` from `getOpsBulk()` documentation
[Docs] Indicate create*Query options.results is a Doc[]
Node.js 18 [has been released][1], and will be the next LTS version, so
we add this to our test matrix.

Node.js 12 has also been [end-of-lifed][2], and is dropped from the test
matrix.

[1]: https://nodejs.org/en/blog/announcements/v18-release-announce/
[2]: https://nodejs.org/en/about/releases/
…iri-1.13.4

Bump nokogiri from 1.13.3 to 1.13.4 in /docs
💥 Update Node.js test matrix
The Node.js v14 `npm install` script keeps stalling. This change
increases our timeout to try and let it pass.
The older version of `npm` can have issues installing packages directly
from Github over SSH. This change updates our `package.json` to
explicitly fetch over HTTPS.
It's best practice to specify a version when depending directly on a
repo.
This change updates our presence documentation to highlight that
disconnections can be seen with a `null` value.
📌 Pin `json0` dev dependency
…iri-1.13.7

Bump nokogiri from 1.13.4 to 1.13.7 in /docs
📝 Update presence documentation
Bumps [tzinfo](https://github.com/tzinfo/tzinfo) from 1.2.9 to 1.2.10.
- [Release notes](https://github.com/tzinfo/tzinfo/releases)
- [Changelog](https://github.com/tzinfo/tzinfo/blob/master/CHANGES.md)
- [Commits](tzinfo/tzinfo@v1.2.9...v1.2.10)

---
updated-dependencies:
- dependency-name: tzinfo
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
…o-1.2.10

Bump tzinfo from 1.2.9 to 1.2.10 in /docs
alecgibson and others added 30 commits February 21, 2023 18:00
At the moment we can only specify one channel the specific query, would be able to listen to, as per docs:
```javascript
backend.use('query', (context, next) => {
  // Set our query to only listen for changes on our user-specific channel
  context.channel = userChannel(context)
  next()
})
```

However let's imagine the situation where the user wants to query all
the posts, the where posted by him and all his friends. Now we would need
new query every for friend separately to make sure the proper scalability is
preserved and we do not receive all the changes to posts collection. This change allows to listen for multiple channels, so if we
want to query all user friends posts. We can do it by this:
```javascript
backend.use('query', (context, next) => {
  // Set our query to only listen for changes on our user-specific channel
  context.channels = [userChannel(context), friendChannel(context))]
  next()
})
```

Now this query would only listen to all the changes that were made to the user
posts and his friends.
…ption

✨ Add multi channel query subscription.
✨ Allow middleware to mutate submitted ops
At the moment we sometimes get some flaky Milestone Mongo test
[failures][1].

This potentially happens because milestone snapshots are saved as a
[fire-and-forget request][2], which means that we technically make no
guarantee about the order that snapshots are written to the database.

Since this is the case, the affected tests may write the v4 snapshot
before the others, and then fail assertions about earlier snapshots.

This change tweaks these tests to count the snapshots instead, which
should be more robust to this race condition.

[1]: https://github.com/share/sharedb-milestone-mongo/actions/runs/4545270938/jobs/8012439274
[2]: https://github.com/share/sharedb/blob/404cde5568bf88d8de12186a90ba6bc168920e23/lib/submit-request.js#L223
✅ Try to fix flaky Milestone DB tests
According to the Node.js [release schedule][1]:

 - v14 will be end-of-lifed on 30 April
 - v20 has been released

This change drops v14 from our test matrix, and adds v20.

[1]: https://nodejs.dev/en/about/releases/
💥 Drop Node.js 14 and add Node.js 20
In our docs, we recommend using [`reconnecting-websocket`][1] to handle
websocket reconnection.

However, [by default][2] that library will [buffer][3] messages when its
underlying socket is closed, which can lead to [undefined behaviour][4]
when ShareDB reconnects, since it works under the assumption that all
messages sent as the socket is closing have been lost (eg pushing
inflight ops back onto the pending queue, etc.).

This change updates our documentation and our examples to set
`{maxEnqueuedMessages: 0}`, which disables this buffering, and should
help to avoid ShareDB reaching undefined states when reconnecting using
this library.

[1]: https://www.npmjs.com/package/reconnecting-websocket
[2]: https://github.com/pladaria/reconnecting-websocket/blob/05a2f7cb0e31f15dff5ff35ad53d07b1bec5e197/reconnecting-websocket.ts#L46
[3]: https://github.com/pladaria/reconnecting-websocket/blob/05a2f7cb0e31f15dff5ff35ad53d07b1bec5e197/reconnecting-websocket.ts#L260
[4]: share#605
At the moment, it's possible for messages to be sent before the client-
server handshake.

Sending messages before the handshake has happened has undefined
behaviour, and can result in errors such as in:
share#605

We can't just ignore these messages, because old clients might
potentially be on v1.0 of the client-server protocol, in which the
server informs the client when it's ready, but not the other way around,
so it's impossible to know when a client should be considered "ready",
and its messages acceptable.

Instead, we add a warning for clients on v1.1 who have sent a message
before their handshake. In order to aid with debugging, we keep track of
the first message received, and log it when the handshake is received
(which means that v1.0 clients will never get such a warning).
🔊 Warn when messages are sent before the v1.1 handshake
📝 Update docs around `reconnecting-websocket`
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.

7 participants